upstream #1
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: 'New features in v1'
|
title: 'New features in v1'
|
||||||
date: '2021-07-28'
|
date: 2021-07-28T15:32:14Z
|
||||||
tags: ['next-js', 'tailwind', 'guide']
|
tags: ['next-js', 'tailwind', 'guide']
|
||||||
draft: false
|
draft: false
|
||||||
summary: 'An overview of the new features released in v1 - code block copy, multiple authors, frontmatter layout and more'
|
summary: 'An overview of the new features released in v1 - code block copy, multiple authors, frontmatter layout and more'
|
||||||
|
11
lib/mdx.js
11
lib/mdx.js
@ -116,6 +116,7 @@ export async function getFileBySlug(type, slug) {
|
|||||||
slug: slug || null,
|
slug: slug || null,
|
||||||
fileName: fs.existsSync(mdxPath) ? `${slug}.mdx` : `${slug}.md`,
|
fileName: fs.existsSync(mdxPath) ? `${slug}.mdx` : `${slug}.md`,
|
||||||
...frontmatter,
|
...frontmatter,
|
||||||
|
date: frontmatter.date ? new Date(frontmatter.date).toISOString() : null,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,9 +136,13 @@ export async function getAllFilesFrontMatter(folder) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const source = fs.readFileSync(file, 'utf8')
|
const source = fs.readFileSync(file, 'utf8')
|
||||||
const { data } = matter(source)
|
const { data: frontmatter } = matter(source)
|
||||||
if (data.draft !== true) {
|
if (frontmatter.draft !== true) {
|
||||||
allFrontMatter.push({ ...data, slug: formatSlug(fileName) })
|
allFrontMatter.push({
|
||||||
|
...frontmatter,
|
||||||
|
slug: formatSlug(fileName),
|
||||||
|
date: frontmatter.date ? new Date(frontmatter.date).toISOString() : null,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user