From b0fe3a5440a8212fec195801540cf5c89b67d637 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Thu, 20 Jun 2024 16:43:45 +0200 Subject: [PATCH] fix: add tutorial to search --- apps/svelte.dev/src/routes/content.json/+server.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/svelte.dev/src/routes/content.json/+server.ts b/apps/svelte.dev/src/routes/content.json/+server.ts index ade5757bc..bc43de644 100644 --- a/apps/svelte.dev/src/routes/content.json/+server.ts +++ b/apps/svelte.dev/src/routes/content.json/+server.ts @@ -18,10 +18,20 @@ function get_href(parts: string[]) { async function content() { const blocks: Block[] = []; const breadcrumbs: string[] = []; - // We want the actual doc contents: docs -> docs/svelte etc -> docs/svelte/overview etc -> docs/svelte/overview/introduction etc - const docs = index.docs.children.flatMap((topic) => + // We want the actual contents: docs -> docs/svelte etc -> docs/svelte/overview etc -> docs/svelte/overview/introduction etc + let docs = index.docs.children.flatMap((topic) => topic.children.flatMap((section) => section.children) ); + docs = docs.concat( + index.tutorial.children.flatMap((topic) => + topic.children.flatMap((section) => + section.children.map((entry) => ({ + ...entry, + slug: `tutorial/${entry.slug.split('/').pop()}` + })) + ) + ) + ); for (const document of docs) { const { slug, body, metadata } = document;