File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed File renamed without changes.
Original file line number Diff line number Diff line change @@ -266,7 +266,12 @@ export async function getStaticPaths() {
266
266
: res . slice ( rootDir . length + 1 ) ;
267
267
} )
268
268
) ;
269
- return files . flat ( ) . filter ( ( file ) => file . endsWith ( '.md' ) ) ;
269
+ return (
270
+ files
271
+ . flat ( )
272
+ // ignores `errors/*.md`, they will be handled by `pages/errors/[error_code].tsx`
273
+ . filter ( ( file ) => file . endsWith ( '.md' ) && ! file . startsWith ( 'errors/' ) )
274
+ ) ;
270
275
}
271
276
272
277
// 'foo/bar/baz.md' -> ['foo', 'bar', 'baz']
@@ -280,6 +285,7 @@ export async function getStaticPaths() {
280
285
}
281
286
282
287
const files = await getFiles ( rootDir ) ;
288
+
283
289
const paths = files . map ( ( file ) => ( {
284
290
params : {
285
291
markdownPath : getSegments ( file ) ,
Original file line number Diff line number Diff line change @@ -121,13 +121,13 @@ export const getStaticProps: GetStaticProps<ErrorDecoderProps> = async ({
121
121
const mdxComponentNames = Object . keys ( MDXComponents ) ;
122
122
123
123
// Read MDX from the file.
124
- let path = params ?. error_code || 'default ' ;
124
+ let path = params ?. error_code || 'index ' ;
125
125
let mdx ;
126
126
try {
127
127
mdx = fs . readFileSync ( rootDir + path + '.md' , 'utf8' ) ;
128
128
} catch {
129
129
// if error_code.md is not found, fallback to default.md
130
- mdx = fs . readFileSync ( rootDir + '/default .md' , 'utf8' ) ;
130
+ mdx = fs . readFileSync ( rootDir + '/index .md' , 'utf8' ) ;
131
131
}
132
132
133
133
// See if we have a cached output first.
You can’t perform that action at this time.
0 commit comments