Skip to content

Add llms.txt to the docs portal - #30

Merged
next-devin merged 3 commits into
mainfrom
llms-txt
Aug 18, 2026
Merged

Add llms.txt to the docs portal#30
next-devin merged 3 commits into
mainfrom
llms-txt

Conversation

@next-devin

Copy link
Copy Markdown
Contributor

Closes #28 — docs.nextcommerce.com/llms.txt currently 404s while developers and www both serve one, and it's the surface evaluating agents most need an index for (~23k AI-crawler requests/week on the zone).

What

A static app/llms.txt/route.ts that generates the index at build time from the Fumadocs source, using fumadocs-core's built-in llms helper — the same generated-from-content-manifest approach the developers portal uses, so it never drifts from the docs tree.

Format follows the llms.txt convention (llmstxt.org):

  • Single H1 + one-line blockquote summary of the portal
  • A related-resources line pointing agents at the developers portal, the changelog, and nextcommerce.com
  • The full docs tree as sectioned link lists, each entry carrying the page's frontmatter description
  • Absolute URLs throughout, since agents fetch this file standalone

Verification

Built the static export locally: out/llms.txt renders 151 lines covering the full tree (Start Here → Build A Store → Manage Orders → Features → Apps → Analytics), every page with its description, no relative links, single H1. npm run build (including the validate-links prebuild) passes.

🤖 Generated with Claude Code

Serves /llms.txt on the static export, generated from the Fumadocs
source via fumadocs-core's llms helper: full docs tree with per-page
one-line descriptions, absolute URLs, and a single-H1 header that
points agents at the developers portal and changelog.

Closes #28

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
nextcommerce-docs 2e7620b Commit Preview URL

Branch Preview URL
Aug 18 2026, 06:09 AM

@next-devin
next-devin marked this pull request as ready for review August 18, 2026 05:48
Comment thread app/llms.txt/route.ts Outdated
Comment thread app/llms.txt/route.ts Outdated
Comment thread app/llms.txt/route.ts Outdated
Comment thread app/llms.txt/route.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
lib/config.ts 5 siteConfig.url has no trailing-slash guard; both consumers (app/llms.txt/route.ts:15, :25) concatenate it with /${path} so a trailing slash would silently produce //changelog and //docs/... in every generated link.
Files Reviewed (2 files)
  • app/llms.txt/route.ts - 0 new issues (all 4 previous findings addressed in b7e2427)
  • lib/config.ts - 1 issue

Fix these issues in Kilo Cloud

Previous Review Summaries (2 snapshots, latest commit b7e2427)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit b7e2427)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
lib/config.ts 5 siteConfig.url has no trailing-slash guard; both consumers (app/llms.txt/route.ts:15, :25) concatenate it with /${path} so a trailing slash would silently produce //changelog and //docs/... in every generated link.
Files Reviewed (2 files)
  • app/llms.txt/route.ts - 0 new issues (all 4 previous findings addressed in b7e2427)
  • lib/config.ts - 1 issue

Fix these issues in Kilo Cloud

Previous review (commit e4644f3)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 3
Issue Details (click to expand)

WARNING

File Line Issue
app/llms.txt/route.ts 26 Fragile ^# Docs$ regex — silently breaks if Fumadocs changes the root heading, producing two H1s and violating llms.txt convention.

SUGGESTION

File Line Issue
app/llms.txt/route.ts 24 replaceAll('](/', ...) is a post-hoc URL heuristic that masks real coupling; prefer a Fumadocs URL formatter so llms() emits absolute URLs directly.
app/llms.txt/route.ts 6 BASE_URL duplicates the canonical origin already declared in wrangler.jsonc and lib/config.ts — promote to siteConfig to avoid drift.
app/llms.txt/route.ts 16 Site-relative /changelog link is only correct because of the replaceAll heuristic; write it as the absolute URL directly so it doesn't regress silently.
Files Reviewed (1 file)
  • app/llms.txt/route.ts - 4 issues

Fix these issues in Kilo Cloud


Reviewed by minimax-m3 · Input: 20.9K · Output: 568 · Cached: 44.6K

… URL rewrite

- Canonical origin moves to siteConfig.url (single place, matches
  wrangler.jsonc) and the hand-authored changelog link uses it directly
  instead of relying on the post-processing.
- The generator's root heading is demoted by position (first H1 line)
  rather than by the literal text '# Docs', so a Fumadocs title change
  can't silently ship two H1s.
- The absolute-URL rewrite is scoped to the generated index only; the
  shared loader keeps relative URLs for the app's own routing, which is
  why the transform lives here rather than in a loader URL formatter.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread lib/config.ts
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@next-devin
next-devin merged commit 64fabfa into main Aug 18, 2026
4 checks passed
@next-devin
next-devin deleted the llms-txt branch August 18, 2026 06:53
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.

Add llms.txt to the docs portal

1 participant