File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -85,19 +85,18 @@ export async function* pageListOf(path: string, prefix = 'pages'): AsyncGenerato
8585 name = name . replace ( MDX_pattern , '' ) ;
8686 path = `${ path } /${ name } ` . replace ( new RegExp ( `^${ prefix } ` ) , '' ) ;
8787
88- if ( node . isFile ( ) && isMDX ) {
89- const article : ArticleMeta = { name, path, subs : [ ] } ;
90- try {
91- const meta = await frontMatterOf ( `${ node . path } /${ node . name } ` ) ;
92-
93- if ( meta ) article . meta = meta ;
94- } catch ( error ) {
95- console . error ( `Error reading front matter for ${ node . path } /${ node . name } :` , error ) ;
88+ if ( node . isFile ( ) ) {
89+ const article : ArticleMeta = { name : isMDX ? name : node . name , path, subs : [ ] } ;
90+
91+ if ( isMDX ) {
92+ try {
93+ const meta = await frontMatterOf ( `${ node . path } /${ node . name } ` ) ;
94+ if ( meta ) article . meta = meta ;
95+ } catch ( error ) {
96+ console . error ( `Error reading front matter for ${ node . path } /${ node . name } :` , error ) ;
97+ }
9698 }
97- yield article ;
98- } else if ( node . isFile ( ) && ! isMDX ) {
99- // Handle non-Markdown files generically
100- const article : ArticleMeta = { name : node . name , path, subs : [ ] } ;
99+
101100 yield article ;
102101 } else if ( node . isDirectory ( ) ) {
103102 const subs = await Array . fromAsync ( pageListOf ( path , prefix ) ) ;
You can’t perform that action at this time.
0 commit comments