From b571816dcddc72a07147389090502c09025b28a6 Mon Sep 17 00:00:00 2001 From: Parinya T <50407646+pickyzz@users.noreply.github.com> Date: Wed, 9 Aug 2023 14:38:16 +0700 Subject: [PATCH] fix: sort posts in [tag] page (#101) * fix: sorted posts in tags page --- src/pages/tags/[tag].astro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/tags/[tag].astro b/src/pages/tags/[tag].astro index ae3a8ed..9c554e7 100644 --- a/src/pages/tags/[tag].astro +++ b/src/pages/tags/[tag].astro @@ -9,6 +9,7 @@ import getUniqueTags from "@utils/getUniqueTags"; import getPostsByTag from "@utils/getPostsByTag"; import slugify from "@utils/slugify"; import { SITE } from "@config"; +import getSortedPosts from "@utils/getSortedPosts"; export interface Props { post: CollectionEntry<"blog">; @@ -33,6 +34,8 @@ const { tag } = Astro.props; const posts = await getCollection("blog", ({ data }) => !data.draft); const tagPosts = getPostsByTag(posts, tag); + +const sortTagsPost = getSortedPosts(tagPosts); --- @@ -43,7 +46,7 @@ const tagPosts = getPostsByTag(posts, tag); >