mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-14 00:32:47 +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
|
@ -126,3 +126,26 @@ export const FrontMatterTOCHeadingLevels = {
|
|||
}),
|
||||
toc_max_heading_level: JoiFrontMatter.number().min(2).max(6),
|
||||
};
|
||||
|
||||
export type ContentVisibility = {
|
||||
draft: boolean;
|
||||
unlisted: boolean;
|
||||
};
|
||||
|
||||
export const ContentVisibilitySchema = JoiFrontMatter.object<ContentVisibility>(
|
||||
{
|
||||
draft: JoiFrontMatter.boolean(),
|
||||
unlisted: JoiFrontMatter.boolean(),
|
||||
},
|
||||
)
|
||||
.custom((frontMatter: ContentVisibility, helpers) => {
|
||||
if (frontMatter.draft && frontMatter.unlisted) {
|
||||
return helpers.error('frontMatter.draftAndUnlistedError');
|
||||
}
|
||||
return frontMatter;
|
||||
})
|
||||
.messages({
|
||||
'frontMatter.draftAndUnlistedError':
|
||||
"Can't be draft and unlisted at the same time.",
|
||||
})
|
||||
.unknown();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue