mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-26 10:55:57 +00:00
Every docs page renders Copy Markdown and View Markdown / Open in ChatGPT /
Claude / Cursor, and every one of those buttons fetched a 404. The renderer that
produces the text sat in lib/get-llm-text.ts with zero importers, and proxy.ts
negotiated content to a route that cannot exist under output: 'export'. The
feature read as broken rather than missing, which is the worse of the two.
It could not be fixed where it was written: `${page.url}.mdx` is not a route this
app can express. The twins move to their own namespace, /llms.mdx/docs/<slugs>/
content.md, which IS expressible, so generateStaticParams prerenders one file per
page — necessary because hanzoai/static computes nothing at request time.
llms-full.txt lands beside llms.txt for the other half of the trade: the index is
a table of contents, so an agent reading it pays a request per page it wants,
while this is one request for everything, already processed to the same text the
twins serve.
Two source fixes were needed to make any of it export, and neither is where the
symptom pointed:
sanitize-mdx.ts already owned the invariant — an unresolvable specifier fails the
WHOLE build — but scoped it to the import header. Docusaurus declares a partial
where it is used, so ported pages import from mid-prose and every header was
already clean. Widened to every top-level ESM import outside a fenced block:
2,062 ported imports dropped, the three surviving @site lines are inside jsx
fences and correctly kept as samples.
packages/mdx adapter.ts: when a ported page fails MDX compilation the loader
emitted a fallback module without _markdown, so getText('processed') threw at
export time complaining about includeProcessedMarkdown, which was enabled. The
missing export moved the crash and blamed the wrong setting; any route walking
the corpus died on the first of 157 such pages.
Measured: exit 0, 5935/5935 static pages, llms-full.txt 17.4 MB over 2953
entries, and 2953 content.md twins — exactly one per docs page. export.require
gains all three so losing them fails the build loudly instead of silently
reverting to 404s.