mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-30 10:48:05 +02:00
fix(plugin-blog): blog archive should hide unlisted blog posts (#9437)
This commit is contained in:
parent
2bb4fd0a65
commit
aa958f0cc1
1 changed files with 4 additions and 2 deletions
|
@ -191,6 +191,8 @@ export default async function pluginContentBlog(
|
||||||
blogTagsListPath,
|
blogTagsListPath,
|
||||||
} = blogContents;
|
} = blogContents;
|
||||||
|
|
||||||
|
const listedBlogPosts = blogPosts.filter(shouldBeListed);
|
||||||
|
|
||||||
const blogItemsToMetadata: {[postId: string]: BlogPostMetadata} = {};
|
const blogItemsToMetadata: {[postId: string]: BlogPostMetadata} = {};
|
||||||
|
|
||||||
const sidebarBlogPosts =
|
const sidebarBlogPosts =
|
||||||
|
@ -213,7 +215,7 @@ export default async function pluginContentBlog(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (archiveBasePath && blogPosts.length) {
|
if (archiveBasePath && listedBlogPosts.length) {
|
||||||
const archiveUrl = normalizeUrl([
|
const archiveUrl = normalizeUrl([
|
||||||
baseUrl,
|
baseUrl,
|
||||||
routeBasePath,
|
routeBasePath,
|
||||||
|
@ -222,7 +224,7 @@ export default async function pluginContentBlog(
|
||||||
// Create a blog archive route
|
// Create a blog archive route
|
||||||
const archiveProp = await createData(
|
const archiveProp = await createData(
|
||||||
`${docuHash(archiveUrl)}.json`,
|
`${docuHash(archiveUrl)}.json`,
|
||||||
JSON.stringify({blogPosts}, null, 2),
|
JSON.stringify({blogPosts: listedBlogPosts}, null, 2),
|
||||||
);
|
);
|
||||||
addRoute({
|
addRoute({
|
||||||
path: archiveUrl,
|
path: archiveUrl,
|
||||||
|
|
Loading…
Add table
Reference in a new issue