Skip to content

Commit 683ba3d

Browse files
feat(docs,blog,pages): add support for "unlisted" front matter - hide md content in production (#8004)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
1 parent 7a023a2 commit 683ba3d

File tree

131 files changed

+2449
-303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+2449
-303
lines changed

packages/docusaurus-plugin-content-blog/src/__tests__/__fixtures__/website-blog-with-tags/blog/another-with-tags-unlisted.md

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/docusaurus-plugin-content-blog/src/__tests__/__fixtures__/website/blog/unlisted.md

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/docusaurus-plugin-content-blog/src/__tests__/__fixtures__/website/build-snap/blog/unlisted/index.html

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/docusaurus-plugin-content-blog/src/__tests__/__snapshots__/index.test.ts.snap

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ exports[`blog plugin works on blog tags without pagination 1`] = `
3030
},
3131
],
3232
"permalink": "/blog/tags/tag-1",
33+
"unlisted": false,
3334
},
3435
"/blog/tags/tag-2": {
3536
"items": [
@@ -57,6 +58,33 @@ exports[`blog plugin works on blog tags without pagination 1`] = `
5758
},
5859
],
5960
"permalink": "/blog/tags/tag-2",
61+
"unlisted": false,
62+
},
63+
"/blog/tags/unlisted": {
64+
"items": [
65+
"/another/blog-with-tags-unlisted",
66+
],
67+
"label": "unlisted",
68+
"pages": [
69+
{
70+
"items": [
71+
"/another/blog-with-tags-unlisted",
72+
],
73+
"metadata": {
74+
"blogDescription": "Blog",
75+
"blogTitle": "Blog",
76+
"nextPage": undefined,
77+
"page": 1,
78+
"permalink": "/blog/tags/unlisted",
79+
"postsPerPage": 1,
80+
"previousPage": undefined,
81+
"totalCount": 1,
82+
"totalPages": 1,
83+
},
84+
},
85+
],
86+
"permalink": "/blog/tags/unlisted",
87+
"unlisted": false,
6088
},
6189
}
6290
`;
@@ -106,6 +134,7 @@ exports[`blog plugin works with blog tags 1`] = `
106134
},
107135
],
108136
"permalink": "/blog/tags/tag-1",
137+
"unlisted": false,
109138
},
110139
"/blog/tags/tag-2": {
111140
"items": [
@@ -133,6 +162,33 @@ exports[`blog plugin works with blog tags 1`] = `
133162
},
134163
],
135164
"permalink": "/blog/tags/tag-2",
165+
"unlisted": false,
166+
},
167+
"/blog/tags/unlisted": {
168+
"items": [
169+
"/another/blog-with-tags-unlisted",
170+
],
171+
"label": "unlisted",
172+
"pages": [
173+
{
174+
"items": [
175+
"/another/blog-with-tags-unlisted",
176+
],
177+
"metadata": {
178+
"blogDescription": "Blog",
179+
"blogTitle": "Blog",
180+
"nextPage": undefined,
181+
"page": 1,
182+
"permalink": "/blog/tags/unlisted",
183+
"postsPerPage": 2,
184+
"previousPage": undefined,
185+
"totalCount": 1,
186+
"totalPages": 1,
187+
},
188+
},
189+
],
190+
"permalink": "/blog/tags/unlisted",
191+
"unlisted": false,
136192
},
137193
}
138194
`;

packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async function testGenerateFeeds(
5454
);
5555

5656
await createBlogFeedFiles({
57-
blogPosts: blogPosts.filter((post) => !post.metadata.frontMatter.draft),
57+
blogPosts,
5858
options,
5959
siteConfig: context.siteConfig,
6060
outDir: context.outDir,

0 commit comments

Comments
 (0)