Allow drafts

pull/8435/head
Puru Vijay 3 years ago
parent 113b8b8005
commit 2f9feb603d

@ -1,5 +1,6 @@
--- ---
title: Actions title: Actions
draft: true
--- ---
TODO TODO

@ -1,5 +1,6 @@
--- ---
title: TypeScript title: TypeScript
draft: true
--- ---
TODO TODO

@ -23,9 +23,11 @@ export function get_docs_data(base = BASE) {
const category_slug = match[1]; const category_slug = match[1];
// Read the meta.json // Read the meta.json
const category_title = JSON.parse( const { title: category_title, draft = 'false' } = JSON.parse(
fs.readFileSync(`${base}/${category_dir}/meta.json`, 'utf-8') fs.readFileSync(`${base}/${category_dir}/meta.json`, 'utf-8')
).title; );
if (draft === 'true') continue;
/** @type {import('./types').Category} */ /** @type {import('./types').Category} */
const category = { const category = {
@ -45,6 +47,9 @@ export function get_docs_data(base = BASE) {
const page_data = extract_frontmatter( const page_data = extract_frontmatter(
fs.readFileSync(`${base}/${category_dir}/${page_md}`, 'utf-8') fs.readFileSync(`${base}/${category_dir}/${page_md}`, 'utf-8')
); );
if (page_data.metadata.draft === 'true') continue;
const page_title = page_data.metadata.title; const page_title = page_data.metadata.title;
const page_content = page_data.body; const page_content = page_data.body;

Loading…
Cancel
Save