docs(site): agent-ready discovery, MD mirrors, tab labels#104
docs(site): agent-ready discovery, MD mirrors, tab labels#104Tom-Arete-A4 wants to merge 7 commits intomainfrom
Conversation
- Early sr-only llms.txt directive via MarkdownContent override - Defer PostHog + tracking to footer (slimmer head) - Post-build .md copies from content sources for /path.md - Disambiguate tab labels on quickstart, filtering-feeds, workflow Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile Summary
Confidence Score: 4/5Safe to merge for the Head/Footer/tab-label changes; the MarkdownContent sr-only paragraph advertises .md mirror URLs that currently return 404, which should be resolved before this goes live. The analytics refactor and tab-label disambiguation are clean. The MarkdownContent override has an unresolved P1: it advertises per-page .md mirror paths in-page (visible to every agent crawler and user) but the script that generates those files is absent from the repo and the build command was not updated, so every advertised link 404s. This caps the score at 4. docs/src/components/overrides/MarkdownContent.astro — advertises .md mirror URLs that are not generated; the missing script and package.json build-chain update need to be included in this PR before merging. Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant Head.astro
participant MarkdownContent.astro
participant Footer.astro
participant DocsClientScripts.astro
participant PostHog
Browser->>Head.astro: Request page
Head.astro-->>Browser: Starlight meta/links only
Browser->>MarkdownContent.astro: Render article body
MarkdownContent.astro-->>Browser: sr-only discovery paragraph + MDX content
Browser->>Footer.astro: Render footer
Footer.astro-->>Browser: Default footer HTML
Footer.astro->>DocsClientScripts.astro: Include after footer
DocsClientScripts.astro->>PostHog: Inject analytics snippet
DocsClientScripts.astro-->>Browser: Delegated click handlers (tab + copy tracking, once per session)
Reviews (6): Last reviewed commit: "chore(docs): modernize .sr-only with cli..." | Re-trigger Greptile |
Resolve package.json: chain main's fix-llms-full + build-docs-index with copy-docs-markdown. Take main quickstart (syncKey installer tabs, step headings). Co-authored-by: Cursor <cursoragent@cursor.com>
Use Starlight's page-load lifecycle as the single analytics setup path, and rely on generated Astro markdown routes instead of a post-build mirror script. Co-authored-by: Cursor <cursoragent@cursor.com>
Point the hidden agent directive at the generated Astro markdown route for the current page instead of describing a mirror file convention. Co-authored-by: Cursor <cursoragent@cursor.com>
Satisfy the docs Prettier check after linking exact markdown routes. Co-authored-by: Cursor <cursoragent@cursor.com>
Re: Issue 1 —
|
Move tab and code-copy click handlers out of astro:page-load. Starlight view-transitions fire astro:page-load on every SPA navigation, so the previous setup re-registered duplicate document-level listeners each time, multiplying analytics events. Delegated handlers survive view-transitions natively, so a single attach at script-execution time is enough. Co-authored-by: Cursor <cursoragent@cursor.com>
Pair the deprecated `clip: rect(0, 0, 0, 0)` rule with `clip-path: inset(50%)` so the visually-hidden agent-discovery paragraph stays hidden under modern CSS Masking semantics while keeping the legacy property for older browsers. Co-authored-by: Cursor <cursoragent@cursor.com>
Review summary — follow-ups for
|
| Commit | Concern | Plan ref | Status |
|---|---|---|---|
abd6262 fix(docs): attach analytics listeners once at module scope |
Tab + code-copy click listeners stacked on every Starlight view-transition (astro:page-load re-arm), inflating analytics events linearly with navigation depth |
Issue 2 (Greptile P1) | Fixed |
ccdc160 chore(docs): modernize .sr-only with clip-path |
.sr-only used only deprecated clip: rect(0,0,0,0) |
Nit N2 | Fixed |
Issue 1 (.md mirrors) is already resolved on this branch — see comment above. The plan's proposed copy-docs-markdown.mjs is intentionally not re-added; Astro dynamic routes (docs/src/pages/[...slug].md.ts, docs/src/pages/index.md.ts) already produce the advertised .md URLs with frontmatter preserved and MDX stripped.
What changed
docs/src/components/DocsClientScripts.astro
- Removed
setupTabTracking/setupCodeCopyTracking/initTrackingwrappers and theastro:page-loadregistration. - Click handlers are now attached once at module-scope script execution, delegated on
document. They survive view-transitions natively (no per-page re-arm needed). window.location.pathnameis read inside the handler, so events still carry the current page after SPA navigations.
docs/src/styles/custom.css
.sr-onlykeeps existingclip: rect(0, 0, 0, 0)for legacy compatibility and addsclip-path: inset(50%)for modern CSS Masking Level 1.- Visual behavior unchanged; agent-discovery paragraph stays hidden.
Verification (local)
npm run build→ 0 errors, 33 pages, 34.mdmirrors generated underdist/.npm run check→ 0 errors / 0 warnings (pre-existingSearch.astrodeprecation hint untouched).npx prettier --check src/components/DocsClientScripts.astro src/styles/custom.css→ clean.- Source inspection: only one
addEventListener(click, ...)per concern at module scope; noastro:page-loadlistener for tracking.
Verification (preview, post-deploy)
curl -I https://<preview>/cli/commands.md→ expect200+Content-Type: text/markdown; charset=utf-8.- DevTools → on a docs page, click any tab once → exactly one
docs_tab_clickedPostHog request fires; navigate 5 pages, click again → still one event per click (not N+1).
Skipped intentionally
- N1 (brittle
starlight-tabs [role=tab]selector) — low priority. - N3 (MDX comment about
syncKeyincompatibility with disambiguated tab labels) — nosyncKeyin affected MDX today. - Plan Issue 1 prescription (
copy-docs-markdown.mjs) — already obsoleted by Astro routes; would regress.
Once Vercel preview is up I'll re-run the markdown spot-checks and trigger Greptile.
Summary
Improvements for docs.arete.run aimed at AFDocs / agent crawlers (Mintlify Agent Score): clearer llms.txt discovery in-page, static markdown mirrors, lighter HTML head, and unique tab labels where scanners flagged ambiguity.
Changes
Out of scope (follow-ups)
Testing
pm run build\ (includes copy script)
pm run check\