mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-28 17:57:48 +02:00
refactor(blog-plugin): blog archive reverse ordering of posts (#9438)
This commit is contained in:
parent
911dfb46d7
commit
f80e1bdb32
1 changed files with 1 additions and 1 deletions
|
@ -54,7 +54,7 @@ function YearsSection({years}: {years: YearProp[]}) {
|
|||
}
|
||||
|
||||
function listPostsByYears(blogPosts: readonly ArchiveBlogPost[]): YearProp[] {
|
||||
const postsByYear = blogPosts.reduceRight((posts, post) => {
|
||||
const postsByYear = blogPosts.reduce((posts, post) => {
|
||||
const year = post.metadata.date.split('-')[0]!;
|
||||
const yearPosts = posts.get(year) ?? [];
|
||||
return posts.set(year, [post, ...yearPosts]);
|
||||
|
|
Loading…
Add table
Reference in a new issue