mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-11 15:22:29 +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
34
packages/docusaurus-plugin-content-blog/src/props.ts
Normal file
34
packages/docusaurus-plugin-content-blog/src/props.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import type {TagsListItem, TagModule} from '@docusaurus/utils';
|
||||
import type {BlogTag, BlogTags} from '@docusaurus/plugin-content-blog';
|
||||
|
||||
export function toTagsProp({blogTags}: {blogTags: BlogTags}): TagsListItem[] {
|
||||
return Object.values(blogTags)
|
||||
.filter((tag) => !tag.unlisted)
|
||||
.map((tag) => ({
|
||||
label: tag.label,
|
||||
permalink: tag.permalink,
|
||||
count: tag.items.length,
|
||||
}));
|
||||
}
|
||||
|
||||
export function toTagProp({
|
||||
blogTagsListPath,
|
||||
tag,
|
||||
}: {
|
||||
blogTagsListPath: string;
|
||||
tag: BlogTag;
|
||||
}): TagModule {
|
||||
return {
|
||||
label: tag.label,
|
||||
permalink: tag.permalink,
|
||||
allTagsPath: blogTagsListPath,
|
||||
count: tag.items.length,
|
||||
unlisted: tag.unlisted,
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue