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
9 changes: 7 additions & 2 deletions src/pages/llms.txt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ export const GET: APIRoute = async ({ site }) => {
// Extract API versions from the collection (e.g. "5x", "4x", "3x")
const apiVersions = [...new Set(api.map((d) => d.id.split('/')[0]))].sort().reverse();

// Extract docs versions (e.g. "5x", "4x")
// Extract docs versions (e.g. "5x", "4x") from the English docs only, so that
// translated locales (de, fr, zh-tw, ...) are not mistaken for versions.
const docs = await getCollection('docs');
const docsVersions = [...new Set(docs.map((d) => d.id.replace('en/', '').split('/')[0]))]
const docsVersions = [
...new Set(
docs.filter((d) => d.id.startsWith('en/')).map((d) => d.id.replace('en/', '').split('/')[0])
),
]
.sort()
.reverse();

Expand Down
6 changes: 5 additions & 1 deletion src/pages/llms/guides-[version].txt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import { getRawMarkdown, buildSection, textResponse } from '@/utils/llms';

export async function getStaticPaths() {
const docs = await getCollection('docs');
const versions = [...new Set(docs.map((d) => d.id.replace('en/', '').split('/')[0]))];
const versions = [
...new Set(
docs.filter((d) => d.id.startsWith('en/')).map((d) => d.id.replace('en/', '').split('/')[0])
),
];
return versions.map((version) => ({ params: { version } }));
}

Expand Down
Loading