mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-18 03:26:57 +02:00
feat(v2): add draft feature to blog posts (#2335)
This commit is contained in:
parent
3cbee86e36
commit
84eeb5120c
5 changed files with 55 additions and 18 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue