Repository navigation
Add tracked Download buttons to resource pages and the landing detail view - #573
Merged
Alejandro Lopez (soyalejolopez) merged 1 commit intoOct 29, 2026
Conversation
… view Resources that are one self-contained file (interactive guides, single-file scripts, PPTX, PBIX, the Technical Advisory PDF) now offer a Download button that records a Clarity resource_download event. The file is derived from the resource folder or set with the optional download front matter field. Archived resources, bundles, declarative agents, and Markdown resources never get one. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Alejandro Lopez (soyalejolopez)
merged commit Oct 29, 2026
b892896
into
microsoft:master
5 checks passed
Alejandro Lopez (soyalejolopez)
deleted the
soyalejolopez-download-buttons
branch
October 29, 2026 16:34
5 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Category
What's in this pull request?
Adds a Download button to resource pages (
r/<slug>/) and the landing-page detail view, and records each click in Clarity as aresource_downloadevent, the same wayresource_previewis recorded. That gives us a download count per resource without adding any tracking to the downloaded files.Which resources get a button (24 of 58)
The catalog picks the file from the resource folder, so nothing needs hand-curating:
interactiveindex.html, saved as<slug>.html. All five interactive pages are single self-contained files with no sibling dependencies (checked).pptx,pbix.pptxor.pbixin the folder.ps1.ps1, and only when the folder has no module, data, or template files next to it, so a script that needs.psm1,.json,.csvand similar is never offered alone.bundle,declarative,mdArchived resources never get one. An optional
downloadfront matter field names the file explicitly (relative path, validated, must exist); the Technical Advisory uses it for its PDF. The button shows the file size.What changed
tools/catalog-build/downloads.js(new): the selection rules, file naming and size formatting.tools/catalog-build/index.js: validatesdownload;catalog.jsongetsdownload,downloadNameanddownloadSizefor eligible resources.tools/catalog-build/site-pages.js,assets/resource-page.css,index.html: the button on resource pages and the landing detail view. Resource pages reuse the existingdata-eventclick handler; the landing page fires the event itself. Pages without a download are byte-for-byte unchanged, so only the 24 pages that gain a button are in this diff.tools/catalog-build/test-downloads.js(new, innpm run check): selection and naming rules.test-site-output.jsnow also checks the rendered link, the Clarity attribute, the size label, and that archived, bundle, declarative and Markdown resources have none.docs/CATALOG-METADATA.md,CHANGELOG.md: document the field and the button.download: Agent-365-Technical-Advisory.pdf, version 1.0.1.Where counts appear: the Clarity dashboard (custom event
resource_download). Clarity's export API does not expose custom events, so the counts are not inresource-stats.jsonor on the cards.Verified in a browser (local server): the button shows with the right file name and size on a resource page and on the landing detail view; clicking fires
resource_download; it is hidden for an archived resource and a bundle; the PDF link returnsapplication/pdf.Related issues
Follows #572.
Checklist
npm ci --prefix tools/catalog-build && npm run check --prefix tools/catalog-build(passes)versionandupdatedwere bumped (andpublishedwas preserved): Technical Advisory only, because its README changedSee CONTRIBUTING.md for details.