Skip to content

fix: unprefix the default dialect in llms.txt links - #713

Open
Bryandero98 wants to merge 1 commit into
drizzle-team:mainfrom
Bryandero98:fix/llms-txt-pg-links
Open

Bryandero98 wants to merge 1 commit into
drizzle-team:mainfrom
Bryandero98:fix/llms-txt-pg-links

Conversation

@Bryandero98

Copy link
Copy Markdown

Summary

[...slug].astro serves the default dialect (pg) unprefixed - a route like docs/pg/select never exists, only docs/select:

const routePrefix =
  dialectId === defaultDocsDialect ? "docs" : `docs/${dialectId}`;

llms.txt.ts's getUrl didn't know this and prefixed every pg slug with pg/ anyway (since the meta-file slugs already carry their directory name as a prefix), so all 71 postgres links in the generated llms.txt 404 - the section most people probably want, since pg is the default.

Fix

Strip the default dialect's own prefix in getUrl before building the URL, reusing defaultDocsDialect from dialect-docs.ts rather than hardcoding "pg", so this stays correct if the default dialect ever changes.

Verification

Ran the dev server and diffed /llms.txt before/after:

$ curl -so /dev/null -w "%{http_code}\n" http://localhost:4321/docs/select
200
$ curl -so /dev/null -w "%{http_code}\n" http://localhost:4321/docs/pg/select
404
$ curl -so /dev/null -w "%{http_code}\n" http://localhost:4321/docs/mysql/select
200
$ grep -c "/docs/pg/" llms.txt   # before: 71, after:
0

All other dialects are untouched (still correctly prefixed). Full test suite (pnpm test, 29 tests) passes.

Fixes #705

🤖 Generated with Claude Code

[...slug].astro serves the default dialect (pg) unprefixed - a route
like docs/pg/select never exists, only docs/select. llms.txt's getUrl
didn't know this and linked every pg page with the pg/ prefix anyway,
so all 71 postgres links in the generated file 404'd.

Reuses defaultDocsDialect from dialect-docs.ts instead of hardcoding
"pg", so this keeps working if the default dialect ever changes.

Fixes drizzle-team#705

Co-Authored-By: Claude Sonnet 5 <[email protected]>

This branch has not been deployed

No deployments
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.

llms.txt lists 71 /docs/pg/* URLs that 404 in production

1 participant