fix twitter and github post links

This commit is contained in:
Timothy
2021-01-10 16:55:38 +08:00
parent ffc0fece52
commit fba98a0b74
2 changed files with 7 additions and 8 deletions

View File

@ -76,6 +76,7 @@ export async function getFileBySlug(type, slug) {
wordCount: content.split(/\s+/gu).length,
readingTime: readingTime(content),
slug: slug || null,
fileName: fs.existsSync(mdxPath) ? `${slug}.mdx` : `${slug}.md`,
...data,
},
}
@ -87,7 +88,6 @@ export async function getAllFilesFrontMatter(type) {
const allFrontMatter = files.reduce((allPosts, postSlug) => {
const source = fs.readFileSync(path.join(root, 'data', type, postSlug), 'utf8')
const { data } = matter(source)
return [
{
...data,