-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Blog posts page: custom sorting logic #5692
Copy link
Copy link
Closed
Labels
featureThis is not a bug or issue with Docusausus, per se. It is a feature request for the future.This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Metadata
Metadata
Assignees
Labels
featureThis is not a bug or issue with Docusausus, per se. It is a feature request for the future.This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Type
Fields
Give feedbackNo fields configured for issues without a type.
🚀 Feature
Let's be less opinionated and let users decide on the sorting logic.
Have you read the Contributing Guidelines on issues?
Yes
Has this been requested on Canny?
Requested on Discord
Motivation
Sorting by descending time works in almost all cases, but we shouldn't assume that all users use the blog for time-based information. E.g., sort by alphabetical order? Sort by tags?
API Design
A new
comparePostsplugin option, which accepts a function that is passed to the sorting algorithm:docusaurus/packages/docusaurus-plugin-content-blog/src/blogUtils.ts
Lines 345 to 347 in b40e459
And yes, it will receive the entire blog post, with all of its metadata and content.
Have you tried building it?
No; should be trivial