chore: sync with v0.3.4
This commit is contained in:
@ -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')
|
||||
@ -80,7 +80,6 @@ export async function getFileBySlug(type, slug) {
|
||||
return {
|
||||
mdxSource,
|
||||
frontMatter: {
|
||||
wordCount: content.split(/\s+/gu).length,
|
||||
readingTime: readingTime(content),
|
||||
slug: slug || null,
|
||||
fileName: fs.existsSync(mdxPath) ? `${slug}.mdx` : `${slug}.md`,
|
||||
|
Reference in New Issue
Block a user