Skip to content

fix(prerender): emit per-section /docs/<slug>.md mirrors (fix llms.txt 404)#198

Merged
mastermanas805 merged 2 commits into
mainfrom
fix/docs-per-section-md-mirrors
Jun 6, 2026
Merged

fix(prerender): emit per-section /docs/<slug>.md mirrors (fix llms.txt 404)#198
mastermanas805 merged 2 commits into
mainfrom
fix/docs-per-section-md-mirrors

Conversation

@mastermanas805

Copy link
Copy Markdown
Member

Bug-3 (bug-hunt follow-up, 2026-06-06). The agent-facing troubleshooting guide is linked from llms.txt as https://instanode.dev/docs/troubleshooting-deploys.md, but that nested per-section .md route returns 404 (verified live). Only /docs.md (the concatenated mirror) and the legal /docs/public/*.md statics resolved — the main docs sections had no per-section .md mirror.

Live evidence (before)

/docs/troubleshooting-deploys.md  → 404   ← the broken contract URL
/docs.md                          → 200   (concatenated mirror)
/docs/public/security.md          → 200   (legal per-section static — precedent that nested docs .md DO serve)

Fix (canonical, lower-risk)

Step 6b of emitMarkdownRoutes now emits /docs/<slug>.md for every .content/docs section, mirroring the existing blog/use-case per-slug .md pattern and the legal /docs/public/*.md precedent (GH Pages serves the nested file directly). Each mirror is the standalone section: an H1 from the frontmatter title + the body with YAML frontmatter stripped — so an agent can fetch ONE section instead of the whole concatenated doc.

The llms.txt reference now 200s as-is, so no public/llms.txt edit and no content-repo llms.txt change are needed — the URL was always correct; the route was the thing missing. (Chose making the route resolve over rewriting the URL: it's the canonical fix, keeps the contract intact, and matches the legal-docs precedent.)

writeRouteMd() gains an includeInAggregate flag (default true); the per-section docs pass false so /llms-full.txt isn't bloated with duplicate docs content (each section already appears in the /docs.md aggregate entry). Verified the aggregate carries /docs.md once and zero per-section duplicates.

Tests — fail-before / pass-after (proven)

src/prerender.test.ts — three source guards pin the emission loop, the includeInAggregate=false aggregate exclusion, and the title+body mirror shape. Proven by stashing the prerender.mjs change (all 3 fail against old code). The guards are deterministic (no filesystem/build dependency) so they run identically under npm run gate and the build-less coverage job — full patch coverage. The existing llmsContract.test.ts keeps troubleshooting-deploys pinned in public/llms.txt, so URL and contract stay in lock-step.

Full npm run gate GREEN (tsc + build + prerender + 1133 vitest). Build locally produces dist/docs/troubleshooting-deploys.md (5527 bytes, standalone H1). Will live-verify the URL 200s after deploy.

🤖 Generated with Claude Code

…t 404)

Bug-3 (bug-hunt follow-up 2026-06-06). The agent-facing troubleshooting guide
is linked from llms.txt as https://instanode.dev/docs/troubleshooting-deploys.md,
but that nested per-section .md route returned 404 (verified live). Only
/docs.md (the concatenated mirror) and the legal /docs/public/*.md statics
resolved — the main docs sections had no per-section .md mirror.

Fix (canonical, lower-risk): Step 6b of emitMarkdownRoutes now emits
/docs/<slug>.md for every .content/docs section, mirroring the existing
blog/use-case per-slug .md pattern and the legal /docs/public/*.md precedent
(GH Pages serves the nested file directly). Each mirror is the standalone
section: an H1 from the frontmatter title + the body with YAML frontmatter
stripped — so an agent can fetch ONE section instead of the whole concatenated
doc. The llms.txt reference now 200s as-is, so NO public/llms.txt edit and NO
content-repo llms.txt change are needed (the URL was always correct; the route
was missing).

writeRouteMd() gains an includeInAggregate flag (default true); the per-section
docs pass false so /llms-full.txt isn't bloated with duplicate docs content
(each section already appears in the /docs.md aggregate entry). Verified the
aggregate carries /docs.md once and no per-section duplicate.

Tests (src/prerender.test.ts): three source guards pin the emission loop, the
includeInAggregate=false aggregate exclusion, and the title+body mirror shape.
Proven fail-before/pass-after by stashing the prerender.mjs change. Guards are
deterministic (no filesystem/build dependency) so they run identically under
`npm run gate` and the build-less coverage job — full patch coverage. The
existing llmsContract.test.ts keeps the troubleshooting-deploys reference
pinned in public/llms.txt, so URL and contract stay in lock-step.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mastermanas805
mastermanas805 enabled auto-merge (squash) June 6, 2026 06:10
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size
dist/assets/index-BZLn7_NF.js 162.22 KB (0%)
dist/assets/index-BsJUZYRr.css 6.13 KB (0%)

@mastermanas805
mastermanas805 merged commit 4c57378 into main Jun 6, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant