Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion plugins/astro-agent-docs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ const SECTIONS = deriveSections(sidebar);
// a charset=utf-8 in the Content-Type header.
const BOM = "\uFEFF";

const LLMS_TXT_DIRECTIVE =
"> For the complete documentation index, see [llms.txt](/llms.txt)\n\n";

/** Strip YAML frontmatter, HTML comments, and MDX artifacts; prepend title heading. */
function cleanMarkdown(raw, isMdx = false) {
const { data, content } = matter(raw);
Expand All @@ -96,7 +99,7 @@ function cleanMarkdown(raw, isMdx = false) {
}
body = body.replace(/\n{3,}/g, "\n\n").trim();
const title = data.title ? `# ${data.title}\n\n` : "";
return BOM + title + body + "\n";
return BOM + title + LLMS_TXT_DIRECTIVE + body + "\n";
}

/**
Expand Down
2 changes: 2 additions & 0 deletions public/_headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*.md
Content-Type: text/markdown; charset=utf-8
Loading