fix(llm): honor llm:false on markdown routes and share the public .md url - #107
Merged
Conversation
… 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.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Two fixes to keep the LLM surface contract consistent:
useCurrentPageMarkdownreturned/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.mdsuffix (e.g./overview/intro.md). The docs root has no markdown source, so it points at/llms.txtinstead. The URL builder is extracted as a puregetPublicMarkdownUrlso the convention is unit-testable.llm: falsewas bypassed on .md URLs. The flag was honored byllms-full.txtand thellms.txtgenerator, butapp/llms.mdx/[[...slug]]/route.tsserved opted-out pages (changelog entries, cookbook author pages) anyway. The route now 404s them viashouldIncludeLLMPage, matching how it already 404s unknown slugs.shouldIncludeLLMPageis synchronous, so the existing.filter()call site inllms-full.txtis correct and untouched.Test plan
getPublicMarkdownUrl(.md suffix, /docs prefix stripping, root -> /llms.txt, /llms.mdx never leaks)shouldIncludeLLMPage(default include,llm: falsein page data and in raw frontmatter, explicitllm: true)llm: falsepage (/cookbook/authors/hussufo.md) returns 404bun test: 308 pass, 0 failbun run checkandbun run typecheck: clean