mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-17 16:47:56 +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[] {
|
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 year = post.metadata.date.split('-')[0]!;
|
||||||
const yearPosts = posts.get(year) ?? [];
|
const yearPosts = posts.get(year) ?? [];
|
||||||
return posts.set(year, [post, ...yearPosts]);
|
return posts.set(year, [post, ...yearPosts]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue