mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-16 10:37:20 +02:00
feat(docs,blog,pages): add support for "unlisted" front matter - hide md content in production (#8004)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
7a023a2c41
commit
683ba3d2a0
131 changed files with 2449 additions and 303 deletions
|
@ -75,6 +75,9 @@ export default async function pluginContentDocs(
|
|||
const aliasedSource = (source: string) =>
|
||||
`~docs/${posixPath(path.relative(pluginDataDirRoot, source))}`;
|
||||
|
||||
// TODO env should be injected into all plugins
|
||||
const env = process.env.NODE_ENV as DocEnv;
|
||||
|
||||
return {
|
||||
name: 'docusaurus-plugin-content-docs',
|
||||
|
||||
|
@ -143,7 +146,7 @@ export default async function pluginContentDocs(
|
|||
versionMetadata,
|
||||
context,
|
||||
options,
|
||||
env: process.env.NODE_ENV as DocEnv,
|
||||
env,
|
||||
});
|
||||
}
|
||||
return Promise.all(docFiles.map(processVersionDoc));
|
||||
|
@ -156,6 +159,9 @@ export default async function pluginContentDocs(
|
|||
versionMetadata,
|
||||
);
|
||||
|
||||
// TODO we only ever need draftIds in further code, not full draft items
|
||||
// To simplify and prevent mistakes, avoid exposing draft
|
||||
// replace draft=>draftIds in content loaded
|
||||
const [drafts, docs] = _.partition(docsBase, (doc) => doc.draft);
|
||||
|
||||
const sidebars = await loadSidebars(versionMetadata.sidebarFilePath, {
|
||||
|
@ -175,11 +181,11 @@ export default async function pluginContentDocs(
|
|||
|
||||
return {
|
||||
...versionMetadata,
|
||||
docs: addDocNavigation(
|
||||
docs: addDocNavigation({
|
||||
docs,
|
||||
sidebarsUtils,
|
||||
versionMetadata.sidebarFilePath as string,
|
||||
),
|
||||
sidebarFilePath: versionMetadata.sidebarFilePath as string,
|
||||
}),
|
||||
drafts,
|
||||
sidebars,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue