Skip to content

Commit 669d821

Browse files
committed
fix: sort posts in tags page
1 parent fef559b commit 669d821

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/tags/[tag]/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { slug } from 'github-slugger'
2-
import { allCoreContent } from 'pliny/utils/contentlayer'
2+
import { allCoreContent, sortPosts } from 'pliny/utils/contentlayer'
33
import siteMetadata from '@/data/siteMetadata'
44
import ListLayout from '@/layouts/ListLayoutWithTags'
55
import { allBlogs } from 'contentlayer/generated'
@@ -34,8 +34,8 @@ export default function TagPage({ params }: { params: { tag: string } }) {
3434
const tag = decodeURI(params.tag)
3535
// Capitalize first letter and convert space to dash
3636
const title = tag[0].toUpperCase() + tag.split(' ').join('-').slice(1)
37-
const filteredPosts = allCoreContent(
37+
const filteredPosts = allCoreContent(sortPosts(
3838
allBlogs.filter((post) => post.tags && post.tags.map((t) => slug(t)).includes(tag))
39-
)
39+
))
4040
return <ListLayout posts={filteredPosts} title={title} />
4141
}

0 commit comments

Comments
 (0)