fix(content-blog): filter unlisted posts from author pages #11559
+13
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pre-flight checklist
I have read the Contributing Guidelines on pull requests.
If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.
Motivation
Fixes a bug where author pages were displaying unlisted blog posts. Author pages should only show listed posts, consistent with tag pages, archive pages, and the main blog list.
Root Cause: The
createAuthorPaginatedRoutefunction was using unfilteredauthorBlogPostsinstead of filtering out unlisted posts before pagination. Unlike tag pages, archive pages, and the main blog list (which all uselistedBlogPosts), author pages were missing the filtering step.Note: The
isUnlisted()function only returnstruein production mode (or withSIMULATE_PRODUCTION_VISIBILITY=true). In development mode, unlisted posts appear as listed, but this is expected behavior - the fix works correctly in production builds.Test Plan
Manual Testing
/blog/authors/slorber)Consistency Check
packages/docusaurus-plugin-content-blog/src/blogUtils.ts:141-152viagetTagVisibility()listedBlogPostsatpackages/docusaurus-plugin-content-blog/src/routes.ts:92,163listedBlogPostsatpackages/docusaurus-plugin-content-blog/src/index.ts:259,295listedAuthorBlogPosts.filter(shouldBeListed)atpackages/docusaurus-plugin-content-blog/src/routes.ts:321,306Testing with Production Flag
Tested with
SIMULATE_PRODUCTION_VISIBILITY=trueto verify unlisted posts are correctly filtered in production mode.Commands Run
Test links
Deploy preview:
https://deploy-preview-11559--docusaurus-2.netlify.app/
Related issues/PRs
None - this is a bug fix identified during code review. The bug report analysis showed that author pages were the only blog route type not filtering unlisted posts, while tag pages, archive pages, and the main blog list all correctly filter them.