From 8096fbe883f492c55f28cbe969e365add6d08109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9B=A7=E5=9B=A7?= Date: Tue, 5 Mar 2024 19:08:21 +0800 Subject: [PATCH] Resolve #12 (#18) --- src/pages/tags/index.astro | 5 ++--- src/utils/getAllTags.ts | 9 +++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pages/tags/index.astro b/src/pages/tags/index.astro index edddb93..ad1426c 100644 --- a/src/pages/tags/index.astro +++ b/src/pages/tags/index.astro @@ -6,13 +6,12 @@ const tags = await getTaxonomy("post", "tags"); const textClasses: string[] = [ "text-3xl text-cyan-400 capitalize", + "text-2xl text-pink-400 capitalize", + "text-2xl text-purple-400 capitalize", "text-xl text-teal-400 capitalize", - "text-md text-red-400 capitalize", "text-lg text-green-400 capitalize", - "text-sm text-orange-400 capitalize", "text-lg text-zinc-400 capitalize", "text-4xl text-red-400 capitalize", - "text-xs text-cyan-400 capitalize", ]; const getRandomClass = (classList: string[]): string => { diff --git a/src/utils/getAllTags.ts b/src/utils/getAllTags.ts index 7f4250c..b07aa23 100644 --- a/src/utils/getAllTags.ts +++ b/src/utils/getAllTags.ts @@ -35,8 +35,13 @@ export const getTaxonomy = async (collection: string, name: string) => { }); } } - const taxonomy = [...new Set(taxonomies)]; - return taxonomy; + const taxonomyMap = new Map(); + taxonomies.forEach((taxonomy) => { + if (!taxonomyMap.has(taxonomy.name)) { + taxonomyMap.set(taxonomy.name, taxonomy); + } + }); + return Array.from(taxonomyMap.values()); }; export const getSinglePage = async (collection: any) => {