|
| 1 | +--- |
| 2 | +name: llm-seo-readiness |
| 3 | +description: >- |
| 4 | + Validates Aptos docs changes for LLM consumption (llms.txt, curated feeds, Markdown exports, HTML→Markdown) |
| 5 | + and for SEO (metadata, sitemap, robots, structured data). Use when adding or restructuring docs, editing |
| 6 | + llms routes or curation, changing Head/meta/OG, updating robots.txt or sitemap behavior, or when the user |
| 7 | + mentions LLMs.txt, AI tool ingestion, crawlers, discoverability, or SEO. |
| 8 | +--- |
| 9 | + |
| 10 | +# LLM and SEO readiness (Aptos docs) |
| 11 | + |
| 12 | +## LLM / machine-readable |
| 13 | + |
| 14 | +- **Frontmatter**: Every new or renamed doc needs accurate `title` and `description` in English; they surface in `/llms.txt` and `.md` exports. Mirror updates in `src/content/docs/zh/` per agent guidelines (Spanish `es/` is out of scope for agent-maintained docs). |
| 15 | +- **Curated lists**: If a page should appear in the LLM index or early in full corpus, update `src/lib/llms-curated-ids.ts` (`LLMS_INDEX_SECTIONS`, `LLMS_SMALL_DOC_IDS`, `FULL_PRIORITY_DOC_IDS` as appropriate). Build fails if an id is missing from English non-draft docs. |
| 16 | +- **Index copy**: User-facing explanations live in `src/content/docs/llms-txt.mdx`, `src/content/docs/build/ai.mdx`, and the Chinese `zh/` counterparts—keep URLs and feed names aligned with `src/pages/llms-index.ts`. |
| 17 | +- **HTML → Markdown**: Shared logic is `src/lib/llms-html-sanitize.ts`. When minifying for `llms-small.txt`, collapse **spaces/tabs only**—never all `\s` (newlines must survive for fenced code and Markdown structure). |
| 18 | +- **Route wiring**: Custom handlers are swapped in via `src/integrations/llms-txt-index.ts`; endpoint implementations live under `src/pages/llms-index.ts`, `src/endpoints/llms-small.txt.ts`, `src/endpoints/llms-full.txt.ts`. |
| 19 | +- **Robots**: `public/robots.txt` should stay consistent with sitemap URL and, when feeds change, the commented LLMs.txt pointers at the bottom. |
| 20 | + |
| 21 | +## SEO |
| 22 | + |
| 23 | +- **Per-page metadata**: Starlight frontmatter `title` / `description` feed OG, Twitter, and schema in `src/starlight-overrides/Head.astro`—avoid empty or placeholder descriptions on public pages. |
| 24 | +- **Sitemap**: Produced by `@astrojs/sitemap` in `astro.config.mjs`; ensure new top-level routes or major URL changes still make sense for indexing. |
| 25 | +- **Hreflang / alternates**: Head override builds language alternates from `SUPPORTED_LANGUAGES`—new locales need config updates, not only content folders. |
| 26 | +- **Draft / hidden content**: Do not rely on curated LLM ids or public sitemap for content that must stay off production; follow existing draft filtering in the `.md` pipeline and curation tests. |
| 27 | + |
| 28 | +## Verification |
| 29 | + |
| 30 | +After substantive changes: |
| 31 | + |
| 32 | +```bash |
| 33 | +pnpm test tests/llms-curated-ids.test.ts tests/llms-html-sanitize.test.ts |
| 34 | +pnpm lint && pnpm check |
| 35 | +``` |
| 36 | + |
| 37 | +For full coverage: `pnpm test` and a production `pnpm build` when touching routes or integrations. |
| 38 | + |
| 39 | +## File map |
| 40 | + |
| 41 | +| Area | Primary locations | |
| 42 | +|------|-------------------| |
| 43 | +| Curation | `src/lib/llms-curated-ids.ts`, `src/lib/llms.ts` | |
| 44 | +| llms.txt body | `src/pages/llms-index.ts` | |
| 45 | +| Feed endpoints | `src/endpoints/llms-small.txt.ts`, `src/endpoints/llms-full.txt.ts` | |
| 46 | +| Plugin override | `src/integrations/llms-txt-index.ts` | |
| 47 | +| Markdown export / sanitize | `src/lib/llms-html-sanitize.ts`, `src/pages/[...slug].md.ts` | |
| 48 | +| User docs | `src/content/docs/llms-txt.mdx`, `build/ai.mdx`, `zh/` | |
| 49 | +| SEO head | `src/starlight-overrides/Head.astro` | |
| 50 | +| Crawlers / sitemap hint | `public/robots.txt` | |
0 commit comments