Skip to content

Commit

Permalink
fix: add tutorial to search
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm committed Jun 20, 2024
1 parent 24cadff commit b0fe3a5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions apps/svelte.dev/src/routes/content.json/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b0fe3a5

Please sign in to comment.