feat: add navigation header to per-page .md files#2596
Open
marekh19 wants to merge 6 commits into
Open
Conversation
Contributor
|
✅ Preview for this PR (commit |
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.
Resolves #2557
Prepends a small frontmatter block to every per-page
.mdserved by docs.apify.com so AI agents reading a single page can followparents/children/previous/nextlinks without having to fetchllms.txtfirst. Shape modeled on Vercel's docs (vercel.com/docs/builds/build-features.md): flat YAML-style frontmatter, no nested trees, links are inline[Title](url.md)so the agent can pick by title without a probing fetch.Implemented as
scripts/addNavHeaders.mjsin thepostbuildchain. Runs after@signalwire/docusaurus-plugin-llms-txtwrites both the per-page.mdfiles andllms-full.txt, so editing only the per-page files leavesllms-full.txtuntouched (the issue requires the header to stay out of it). Reads the real left-menu trees from.docusaurus/docusaurus-plugin-content-docs/*/p/*.json, so labels, ordering, and prev/next exactly match the live sidebar.A few design decisions worth recording:
Header shape — modeled on Vercel's docs: flat YAML-ish frontmatter, links as inline
[Title](url.md)so an agent can pick by title without a probing fetch.Children stay flat (direct only). A full recursive sub-tree explodes on exactly the pages an agent lands on first —
/api/v2would carry 269 nested links, /platform/integrations 66,/platform/actors57. That pollutes the header and bloats neighbouring content for no real gain: the agent can walk down one hop at a time via each page's own children.Parents go all the way up. The opposite trade-off — a breadcrumb is a single chain bounded by site depth (~5 max), so there's no blow-up risk. Every page now chains llms.txt root → section landing → category ancestors, giving a reliable "zoom back out" path. This also fixes 83 top-level pages that previously had no parents at all.
Kept out of
llms-full.txtfor free by running inpostbuild, after the llms-txt plugin has already written llms-full.txt from the same per-page content.previous/next links mirror the site's prev/next buttons.
Example 👀
https://pr-2596.preview.docs.apify.com/platform/actors/running.md