Skip to content

fix(llm): honor llm:false on markdown routes and share the public .md url - #107

Merged
nibzard merged 1 commit into
mainfrom
fix/llm-surface-contract
Jul 31, 2026
Merged

fix(llm): honor llm:false on markdown routes and share the public .md url#107
nibzard merged 1 commit into
mainfrom
fix/llm-surface-contract

Conversation

@nibzard

@nibzard nibzard commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Two fixes to keep the LLM surface contract consistent:

  • Share hook leaked an internal route. useCurrentPageMarkdown returned /llms.mdx/<path>, the internal middleware rewrite target. It now returns the public convention from feat(llms): drop cookbook author pages and advertise .md URLs #84: the page path with a .md suffix (e.g. /overview/intro.md). The docs root has no markdown source, so it points at /llms.txt instead. The URL builder is extracted as a pure getPublicMarkdownUrl so the convention is unit-testable.
  • llm: false was bypassed on .md URLs. The flag was honored by llms-full.txt and the llms.txt generator, but app/llms.mdx/[[...slug]]/route.ts served opted-out pages (changelog entries, cookbook author pages) anyway. The route now 404s them via shouldIncludeLLMPage, matching how it already 404s unknown slugs.

shouldIncludeLLMPage is synchronous, so the existing .filter() call site in llms-full.txt is correct and untouched.

Test plan

  • New unit tests for getPublicMarkdownUrl (.md suffix, /docs prefix stripping, root -> /llms.txt, /llms.mdx never leaks)
  • New unit tests for shouldIncludeLLMPage (default include, llm: false in page data and in raw frontmatter, explicit llm: true)
  • New e2e assertion: an llm: false page (/cookbook/authors/hussufo.md) returns 404
  • bun test: 308 pass, 0 fail
  • bun run check and bun run typecheck: clean

… url

The llms.mdx route served pages that opt out of LLM surfaces with
llm: false frontmatter (changelog entries, cookbook author pages) at
.md and content-negotiated URLs. It now 404s them via
shouldIncludeLLMPage, matching llms-full.txt and the llms.txt
generator.

The LLM share hook returned the internal /llms.mdx rewrite target.
It now returns the public convention: the page path with a .md
suffix, with the docs root pointing at /llms.txt since the landing
page has no markdown source.
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Jul 31, 2026 12:44pm

Request Review

@nibzard
nibzard merged commit 9437e27 into main Jul 31, 2026
3 checks passed
@nibzard
nibzard deleted the fix/llm-surface-contract branch July 31, 2026 12:51
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