File tree Expand file tree Collapse file tree
src/pages/skills/[slug]/references Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,10 +11,17 @@ function getContentType(path: string): string {
1111
1212export async function getStaticPaths ( ) {
1313 const entries = await getSkillFileEntries ( ) ;
14- return entries . map ( ( e ) => ( {
15- params : { slug : e . name , path : e . path } ,
16- props : { content : e . content , filePath : e . path } ,
17- } ) ) ;
14+ // This route already lives under `references/`, so the catch-all `[...path]`
15+ // must be the path *relative to* `references/`. Passing the full `references/<...>`
16+ // path doubles the segment, emitting `/skills/<slug>/references/references/<...>`
17+ // and 404ing the documented `/skills/<slug>/references/<...>` URL.
18+ const prefix = 'references/' ;
19+ return entries
20+ . filter ( ( e ) => e . path . startsWith ( prefix ) )
21+ . map ( ( e ) => ( {
22+ params : { slug : e . name , path : e . path . slice ( prefix . length ) } ,
23+ props : { content : e . content , filePath : e . path } ,
24+ } ) ) ;
1825}
1926
2027export const GET : APIRoute = ( { props } ) => {
You can’t perform that action at this time.
0 commit comments