From 38251b6c5b6fb98783ac6e5f14b33bf37f306f98 Mon Sep 17 00:00:00 2001 From: Alejandro Lopez Date: Mon, 2 Nov 2026 13:18:14 -0600 Subject: [PATCH] Show view counts on the shareable resource pages Each r// page now has a Views row in its details panel, between Format and Version, matching the catalog's detail view. The page reads resource-stats.json in the browser, so counts update without rebuilding the pages. The row stays hidden if the file cannot be read, and download pages do not have one. A resource with no recorded views reads 0. - Hover text is the same as the catalog's, and a test fails if the two drift apart. - Tests cover the row's position, the script's source and slug lookup, the hidden-row CSS, and the absence of the row on download pages. - Regenerated the 58 resource pages. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- assets/resource-page.css | 2 ++ assets/resource-page.js | 21 +++++++++++++++++++ r/add-engagegroupadmins/index.html | 2 +- r/agent-365-enablement-checklist/index.html | 2 +- r/agent-365-lifecycle-atlas/index.html | 2 +- r/agent-brainstorming-template/index.html | 2 +- r/agents-cost-calculator/index.html | 2 +- r/ai-council/index.html | 2 +- r/analyze-sharepointrisk/index.html | 2 +- r/autoreply-agent/index.html | 2 +- r/comparedocs/index.html | 2 +- r/copilot-agents-guide/index.html | 2 +- .../index.html | 2 +- r/copilot-interaction-report/index.html | 2 +- r/copilot-studio-workflow/index.html | 2 +- r/create-engagecommunities/index.html | 2 +- r/deepresearch/index.html | 2 +- r/delete-allcommunityposts/index.html | 2 +- r/delete-engagegroups/index.html | 2 +- r/delete-engageusers/index.html | 2 +- r/disable-insightsheadspace/index.html | 2 +- .../index.html | 2 +- .../index.html | 2 +- r/export-copilotinteractions/index.html | 2 +- r/export-engagefiles/index.html | 2 +- r/export-engagenetworkdata/index.html | 2 +- r/export-m365copilotreports/index.html | 2 +- r/export-simpleplacesvisual/index.html | 2 +- r/find-mailboxdelegates/index.html | 2 +- r/get-aadadminrolemembers/index.html | 2 +- r/get-allinsightslicensedusers/index.html | 2 +- r/get-engagegroupinfo/index.html | 2 +- r/get-groupsmembersmanagers/index.html | 2 +- r/get-licenseusage/index.html | 2 +- r/get-m365copilotreadiness/index.html | 2 +- r/get-recurringteamsmeetings/index.html | 2 +- r/get-siteinventory/index.html | 2 +- r/get-teamsuseractivityreport/index.html | 2 +- r/get-yammersitesize/index.html | 2 +- r/managersimulator/index.html | 2 +- .../index.html | 2 +- .../index.html | 2 +- r/migrate-copilotstudioagents/index.html | 2 +- r/omniagent/index.html | 2 +- r/powerclaw-agent/index.html | 2 +- r/preflight-onedrive/index.html | 2 +- r/productquote-agent/index.html | 2 +- r/purview-audit-copilot-report/index.html | 2 +- r/reasoningagent/index.html | 2 +- .../index.html | 2 +- r/simplegraph/index.html | 2 +- .../index.html | 2 +- r/teams-phone-system-snippets/index.html | 2 +- r/teams-phone-user-migration/index.html | 2 +- r/teams-rooms-snippets/index.html | 2 +- r/teams-upgrade-snippets/index.html | 2 +- r/update-vivaengagelicensingtoggle/index.html | 2 +- r/vibewriting-agent/index.html | 2 +- .../index.html | 2 +- r/viva-insights-copilot-dashboard/index.html | 2 +- tools/catalog-build/site-pages.js | 4 +++- tools/catalog-build/test-site-output.js | 13 ++++++++++++ 62 files changed, 97 insertions(+), 59 deletions(-) diff --git a/assets/resource-page.css b/assets/resource-page.css index fb6bf255..dcc2708a 100644 --- a/assets/resource-page.css +++ b/assets/resource-page.css @@ -104,6 +104,8 @@ aside { align-self: start; position: sticky; top: 5rem; } .row:last-child { border-bottom: 0; } .row dt { color: var(--text-muted); } .row dd { text-align: right; font-weight: 500; } +.row[hidden] { display: none; } +#viewsValue { font-family: var(--font-mono); font-variant-numeric: tabular-nums; } .aside-links { display: grid; gap: 0.5rem; margin-top: 1rem; font-size: 0.875rem; } .site-footer { border-top: 1px solid var(--border); padding: 2.5rem 0; color: var(--text-muted); font-size: 0.875rem; text-align: center; } diff --git a/assets/resource-page.js b/assets/resource-page.js index c7416204..0f51c0ea 100644 --- a/assets/resource-page.js +++ b/assets/resource-page.js @@ -52,6 +52,27 @@ }); } + // Views come from the published stats, so the page needs no rebuild when the counts change. The row + // stays hidden if the file cannot be read. Keep VIEWS_TIP in step with the catalog (index.html). + var VIEWS_TIP = "Catalog page views recorded by Microsoft Clarity since Jul 2026, plus views of the resource's GitHub folder from saved snapshots (Apr\u2013Jun and 14\u201327 Oct 2026). Some days were never captured, so this is a minimum."; + var viewsRow = document.getElementById('viewsRow'); + var viewsValue = document.getElementById('viewsValue'); + if (viewsRow && viewsValue && slug && script && script.src && window.fetch) { + fetch(new URL('../resource-stats.json', script.src).href, { cache: 'no-cache' }) + .then(function (response) { if (!response.ok) throw new Error('HTTP ' + response.status); return response.json(); }) + .then(function (data) { + if (!data || !data.resources || typeof data.resources !== 'object') return; + var entry = data.resources[slug]; + var views = entry ? Number(entry.views) : 0; + if (!isFinite(views) || views < 0) views = 0; + var short = views >= 10000 ? (views / 1000).toFixed(0) + 'k' : views >= 1000 ? (views / 1000).toFixed(1) + 'k' : String(views); + viewsValue.textContent = short; + viewsRow.title = views.toLocaleString('en-US') + (views === 1 ? ' view. ' : ' views. ') + VIEWS_TIP; + viewsRow.hidden = false; + }) + .catch(function () { /* leave the row hidden */ }); + } + // The download page saves the file by itself; its visible link covers blocked scripts. var autoDownload = document.querySelector('[data-autodownload]'); if (autoDownload) { diff --git a/r/add-engagegroupadmins/index.html b/r/add-engagegroupadmins/index.html index 67dc78b0..7701a4d2 100644 --- a/r/add-engagegroupadmins/index.html +++ b/r/add-engagegroupadmins/index.html @@ -79,7 +79,7 @@

Related resources