fix: slug links for nested posts

This commit is contained in:
Timothy Lin committed 2021-05-26 19:20:24 +08:00
1 parent 3c3cb9cbeb
commit 52ff63576b
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -42,8 +42,8 @@ export function dateSortDesc(a, b) {
}
export async function getFileBySlug(type, slug) {
const mdxPath = path.join(root, 'data', type, `${slug.join('/')}.mdx`)
const mdPath = path.join(root, 'data', type, `${slug.join('/')}.md`)
const mdxPath = path.join(root, 'data', type, `${slug}.mdx`)
const mdPath = path.join(root, 'data', type, `${slug}.md`)
const source = fs.existsSync(mdxPath)
? fs.readFileSync(mdxPath, 'utf8')
: fs.readFileSync(mdPath, 'utf8')