feat(content-blog): allow sorting posts in ascending order (#5787)

This commit is contained in:
Devtato 2021-11-09 18:25:43 +01:00 committed by GitHub
parent 8fba542d26
commit 1c024470e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 0 deletions

View file

@ -294,6 +294,9 @@ export async function generateBlogPosts(
(a, b) => b.metadata.date.getTime() - a.metadata.date.getTime(),
);
if (options.sortPosts === 'ascending') {
return blogPosts.reverse();
}
return blogPosts;
}