feat(blog): allow processing blog posts through a processBlogPosts function#9886
Merged
feat(blog): allow processing blog posts through a processBlogPosts function#9886
Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the deploy preview of this PR
|
|
Size Change: 0 B Total Size: 992 kB ℹ️ View Unchanged
|
slorber
reviewed
Feb 23, 2024
slorber
reviewed
Feb 23, 2024
slorber
requested changes
Feb 26, 2024
Collaborator
slorber
left a comment
There was a problem hiding this comment.
Almost looks good
That would also be nice to have an extra test in index.test.ts to cover the fact that the processBlogPost option has an impact on the plugin loadContent result.
For example, take a simple site with 10 blog posts, page size = 3, and provide a processBlogPosts that only take the 4 first blog posts in the list: the resulting number of pages should be 2 instead of 4.
This kind of test ensures the plugin works overall, and covers the fact that applyProcessBlogPosts is called before blogPosts.filter(shouldBeListed), which is important otherwise we would have a bug.
packages/docusaurus-plugin-content-blog/src/__tests__/blogUtils.test.ts
Outdated
Show resolved
Hide resolved
packages/docusaurus-plugin-content-blog/src/__tests__/blogUtils.test.ts
Outdated
Show resolved
Hide resolved
packages/docusaurus-plugin-content-blog/src/__tests__/blogUtils.test.ts
Outdated
Show resolved
Hide resolved
8 tasks
slorber
requested changes
Feb 26, 2024
packages/docusaurus-plugin-content-blog/src/plugin-content-blog.d.ts
Outdated
Show resolved
Hide resolved
slorber
reviewed
Feb 27, 2024
packages/docusaurus-plugin-content-blog/src/__tests__/__snapshots__/index.test.ts.snap
Outdated
Show resolved
Hide resolved
… of in nodejs code (#9868) Co-authored-by: OzakIOne <OzakIOne@users.noreply.github.com> Co-authored-by: sebastien <lorber.sebastien@gmail.com>
slorber
reviewed
Mar 1, 2024
This reverts commit 062569f.
slorber
reviewed
Mar 5, 2024
packages/docusaurus-plugin-content-blog/src/__tests__/blogUtils.test.ts
Outdated
Show resolved
Hide resolved
slorber
requested changes
Mar 5, 2024
packages/docusaurus-plugin-content-blog/src/plugin-content-blog.d.ts
Outdated
Show resolved
Hide resolved
This was referenced Aug 15, 2024
This was referenced Aug 27, 2024
This was referenced Sep 4, 2024
This was referenced Sep 8, 2024
This was referenced Sep 11, 2024
This was referenced Sep 28, 2024
This was referenced Oct 4, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
This new option
processBlogPostallow the user to modifyBlogPostarray used in archive page and blog page.For example the user can filter to only list blogs that were created after year 2020 or sort
BlogPostby alphabetical order.#9840 (review)
Test Plan
yarn jest docusaurus-plugin-content-blog --watchTest links
Blog page
Archive page
processBlogPosts documentation
Related issues/PRs
Supersed #9840
Fix #9831
Fix #9827