We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
docs/sections
1 parent 5c79e0a commit cf47681Copy full SHA for cf47681
apps/svelte.dev/src/routes/docs/sections/+server.ts
@@ -0,0 +1,21 @@
1
+import { docs } from '$lib/server/content';
2
+import { json } from '@sveltejs/kit';
3
+
4
+export const prerender = true;
5
6
+export function GET({ url: { searchParams } }) {
7
+ const complete = searchParams.has('complete');
8
+ // by default we return a light version with just the title, the slug and the file path
9
+ // but the user can opt in to get the complete content by adding ?complete
10
+ if (complete) {
11
+ return json(docs.pages);
12
+ }
13
+ return json(
14
+ Object.fromEntries(
15
+ Object.entries(docs.pages).map(([key, page]) => [
16
+ key,
17
+ { metadata: { title: page.metadata.title }, slug: page.slug, file: page.file }
18
+ ])
19
+ )
20
+ );
21
+}
0 commit comments