File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 11import { MdxFile } from '@/util/loadMdx.server' ;
22import Link from 'next/link' ;
3+ import path from 'path' ;
34
45/*
56PostListItem is each resource under a section of content on the homepage.
@@ -67,16 +68,20 @@ export function formatFileListItemsForPostList(
6768 return null ;
6869 }
6970
70- return items . map (
71- ( item ) : PostListItem => ( {
71+ return items . map ( ( item ) : PostListItem => {
72+ const parts = item . slug . split ( path . sep ) . filter ( ( part ) => {
73+ return ! ! part && part !== 'content' ;
74+ } ) ;
75+
76+ return {
7277 title : item . meta . title ,
7378 description : item . meta . description ,
74- href : `/${ item . slug . replace ( 'content/' , ' ') } ` ,
79+ href : `/${ parts . join ( '/ ') } ` ,
7580 children : formatFileListItemsForPostList (
7681 item . children ,
7782 depth ,
7883 internalCurLevel + 1 ,
7984 ) ,
80- } ) ,
81- ) ;
85+ } ;
86+ } ) ;
8287}
You can’t perform that action at this time.
0 commit comments