From 669d821b806a087f1189469c345b90f41ab58fa0 Mon Sep 17 00:00:00 2001 From: Lays Date: Sun, 3 Sep 2023 21:45:13 +0800 Subject: [PATCH 1/2] fix: sort posts in tags page --- app/tags/[tag]/page.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/tags/[tag]/page.tsx b/app/tags/[tag]/page.tsx index 94d321cbd7..6961d4b657 100644 --- a/app/tags/[tag]/page.tsx +++ b/app/tags/[tag]/page.tsx @@ -1,5 +1,5 @@ import { slug } from 'github-slugger' -import { allCoreContent } from 'pliny/utils/contentlayer' +import { allCoreContent, sortPosts } from 'pliny/utils/contentlayer' import siteMetadata from '@/data/siteMetadata' import ListLayout from '@/layouts/ListLayoutWithTags' import { allBlogs } from 'contentlayer/generated' @@ -34,8 +34,8 @@ export default function TagPage({ params }: { params: { tag: string } }) { const tag = decodeURI(params.tag) // Capitalize first letter and convert space to dash const title = tag[0].toUpperCase() + tag.split(' ').join('-').slice(1) - const filteredPosts = allCoreContent( + const filteredPosts = allCoreContent(sortPosts( allBlogs.filter((post) => post.tags && post.tags.map((t) => slug(t)).includes(tag)) - ) + )) return } From a06efea2cb1da8354a5f7c05c56594ed3e9391f7 Mon Sep 17 00:00:00 2001 From: Lays Date: Fri, 8 Sep 2023 15:45:27 +0800 Subject: [PATCH 2/2] chore: run prettier for tags page --- app/tags/[tag]/page.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/tags/[tag]/page.tsx b/app/tags/[tag]/page.tsx index 6961d4b657..46ca528536 100644 --- a/app/tags/[tag]/page.tsx +++ b/app/tags/[tag]/page.tsx @@ -34,8 +34,8 @@ export default function TagPage({ params }: { params: { tag: string } }) { const tag = decodeURI(params.tag) // Capitalize first letter and convert space to dash const title = tag[0].toUpperCase() + tag.split(' ').join('-').slice(1) - const filteredPosts = allCoreContent(sortPosts( - allBlogs.filter((post) => post.tags && post.tags.map((t) => slug(t)).includes(tag)) - )) + const filteredPosts = allCoreContent( + sortPosts(allBlogs.filter((post) => post.tags && post.tags.map((t) => slug(t)).includes(tag))) + ) return }