Skip to content

Commit 2cd0c81

Browse files
authored
Merge pull request #708 from L4ys/main
fix: sort posts in tags page
2 parents 01e3357 + a06efea commit 2cd0c81

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/tags/[tag]/page.tsx

Lines changed: 2 additions & 2 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'
@@ -35,7 +35,7 @@ export default function TagPage({ params }: { params: { tag: string } }) {
3535
// Capitalize first letter and convert space to dash
3636
const title = tag[0].toUpperCase() + tag.split(' ').join('-').slice(1)
3737
const filteredPosts = allCoreContent(
38-
allBlogs.filter((post) => post.tags && post.tags.map((t) => slug(t)).includes(tag))
38+
sortPosts(allBlogs.filter((post) => post.tags && post.tags.map((t) => slug(t)).includes(tag)))
3939
)
4040
return <ListLayout posts={filteredPosts} title={title} />
4141
}

0 commit comments

Comments
 (0)