We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c0eb80a commit c9eae0cCopy full SHA for c9eae0c
src/pages/tags/[tag].astro
@@ -8,9 +8,12 @@ export async function getStaticPaths() {
8
];
9
10
return uniqueTags.map((tag) => {
11
- const filteredPosts = allPosts.filter((post) =>
12
- post.frontmatter.tags.includes(tag)
13
- );
+ const filteredPosts = allPosts
+ .filter((post) => post.frontmatter.tags.includes(tag))
+ .sort(
14
+ (a, b) =>
15
+ new Date(b.frontmatter.pubDate) - new Date(a.frontmatter.pubDate)
16
+ );
17
return {
18
params: { tag },
19
props: { posts: filteredPosts },
0 commit comments