Skip to content

Commit c45e78b

Browse files
feat: add docs/experimental/sections.json endpoint to list all docs sections (#1556)
* feat: add `docs/sections` endpoint to list all docs sections * fix: remove query param * chore: rename to `sections.json` and add `use_cases` metadata * fix: add `/experimental` to route * fix: remove unused `file`
1 parent bea4ed6 commit c45e78b

File tree

1 file changed

+18
-0
lines changed
  • apps/svelte.dev/src/routes/docs/experimental/sections.json

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { docs } from '$lib/server/content';
2+
import { json } from '@sveltejs/kit';
3+
4+
export const prerender = true;
5+
6+
export function GET() {
7+
return json(
8+
Object.fromEntries(
9+
Object.entries(docs.pages).map(([key, page]) => [
10+
key,
11+
{
12+
metadata: { title: page.metadata.title, use_cases: page.metadata.use_cases },
13+
slug: page.slug
14+
}
15+
])
16+
)
17+
);
18+
}

0 commit comments

Comments
 (0)