feat(v2): add draft feature to blog posts (#2335)

This commit is contained in:
Alexey Pyltsyn 2020-02-29 08:20:00 +03:00 committed by GitHub
parent 3cbee86e36
commit 84eeb5120c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 18 deletions

View file

@ -107,6 +107,10 @@ export async function generateBlogPosts(
const fileString = await fs.readFile(source, 'utf-8');
const {frontMatter, content, excerpt} = parse(fileString);
if (frontMatter.draft && process.env.NODE_ENV === 'production') {
return;
}
let date;
// Extract date and title from filename.
const match = blogFileName.match(FILENAME_PATTERN);