facebook/docusaurus
Author pages include unlisted posts (missing filtering in createAuthorsRoutes)
Summary
Context: The
createAuthorsRoutesfunction inroutes.tsgenerates paginated routes for author pages, which list all blog posts written by each author.Bug: Author pages include unlisted blog posts in their pagination, exposing posts that are marked as unlisted (
unlisted: truein frontmatter).Actual vs. expected: Unlisted blog posts appear on author pages, whereas they should only appear on the main blog list pagination, tag pages, and archive pages when explicitly filtered.
Impact: Unlisted blog posts are inappropriately exposed on author pages, violating the intended behavior of the
unlistedfeature which is meant to keep posts accessible only via direct links.
Code with bug
In packages/docusaurus-plugin-content-blog/src/routes.ts, the createAuthorsRoutes function:
Logical proof
Input includes both listed and unlisted posts in
blogPosts.The codebase defines
listedBlogPostsasblogPosts.filter(shouldBeListed), but author pages do not use it.groupBlogPostsByAuthorKey({authorsMap, blogPosts})receives the unfilteredblogPosts, so each author’s group includes unlisted posts.paginateBlogPosts({ blogPosts: authorBlogPosts, ... })paginates whatever it receives; it does not filter byunlisted.The resulting route modules use
blogPostItemsModule(items), which therefore includes unlisted posts.Conclusion: Unlisted posts are rendered on author pages because filtering is never applied for authors, unlike tag, archive, and main list pages which use filtered inputs.
Recommended fix
Filter out unlisted posts before pagination in author routes:
Alternatively, pass listedBlogPosts to groupBlogPostsByAuthorKey instead of blogPosts, though the above approach is more localized and matches the pattern used for tag pages.