upstream #1

Merged
jblu merged 1007 commits from upstream into main 2024-11-04 22:35:57 -06:00
2 changed files with 9 additions and 4 deletions
Showing only changes of commit f8ec940c36 - Show all commits

View File

@ -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'

View File

@ -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,
})
} }
}) })