File tree Expand file tree Collapse file tree 2 files changed +4
-13
lines changed
apps/svelte.dev/src/routes/docs/[topic]/[...path] Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Original file line number Diff line number Diff line change 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" >
Original file line number Diff line number Diff 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} ) ;
You can’t perform that action at this time.
0 commit comments