Replies: 5 comments 6 replies
-
We plan to have some kind of Would your use-case be solved by such an imaginary config? const showDrafts = process.env.SHOW_DRAFTS === "true";
const siteConfig = {
markdown: {
createFrontMatter: async ({
plugin,
filePath,
defaultCreateFrontMatter // reuse existing utils parseFrontMatter
}) => {
const frontMatter = await defaultCreateFrontMatter(filePath);
if (frontMatter.draft === true && showDrafts) {
return {...frontMatter, draft: false}
}
return frontMatter,
}
}
}; SHOW_DRAFTS=true yarn docusaurus build
SHOW_DRAFTS=false yarn docusaurus build |
Beta Was this translation helpful? Give feedback.
-
But Seems like every way has been blocked. 😖 |
Beta Was this translation helpful? Give feedback.
-
Update:
Now I override this line: To: const env = process.env.INTERNAL ? process.env.NODE_ENV : 'development' as DocEnv; When bundling the site on staging mode, set |
Beta Was this translation helpful? Give feedback.
-
I also use a remark plugin to add a draft admonition when bundling. Admonitions will show on draft pages, whether in dev mode or not. But it can be remove when this feature landing: #8285 |
Beta Was this translation helpful? Give feedback.
-
Related: https://docusaurus.io/feature-requests/p/passing-front-matter-to-remarkplugins |
Beta Was this translation helpful? Give feedback.
-
Feature request:
Add an option to the config file, to keep drafts in production builds.
Use case:
Add
draft: true
to some docs' front-matter, bundle two sites, one of them hides the drafts as production, and another shows them for staging/internal.Beta Was this translation helpful? Give feedback.
All reactions