Skip to content

Commit f4053f7

Browse files
committed
fix
1 parent 27ed5d8 commit f4053f7

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

apps/svelte.dev/src/routes/docs/[topic]/[...path]/+layout.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<div class="container">
99
<div class="toc-container" style="order: 1">
10-
<DocsContents contents={await get_sections(params)} />
10+
<DocsContents contents={await get_sections(params.topic)} />
1111
</div>
1212

1313
<div class="page content">

apps/svelte.dev/src/routes/docs/[topic]/[...path]/data.remote.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,9 @@ const schema = v.object({
1010
topic: v.string()
1111
});
1212

13-
export const get_sections = prerender(schema, (params) => {
14-
const document = docs.topics[`docs/${params.topic}`];
15-
16-
// TODO does the dependency on params.path mean this gets regenerated unnecessarily?
17-
if (!document) {
18-
// in many cases, https://svelte.dev/docs/foo is now https://svelte.dev/docs/svelte/foo
19-
if (docs.pages[`docs/svelte/${params.path}`]) {
20-
redirect(308, `/docs/svelte/${params.path}`);
21-
}
22-
23-
error(404, 'Not found');
24-
}
13+
export const get_sections = prerender(v.string(), (topic) => {
14+
const document = docs.topics[`docs/${topic}`];
15+
if (!document) error(404, 'Not found');
2516

2617
return document.children.map(create_summary);
2718
});

0 commit comments

Comments
 (0)