Skip to content

Commit

Permalink
Resolve #12 (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
mewim authored Mar 5, 2024
1 parent 06e6369 commit 8096fbe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/pages/tags/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
9 changes: 7 additions & 2 deletions src/utils/getAllTags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ export const getTaxonomy = async (collection: string, name: string) => {
});
}
}
const taxonomy = [...new Set(taxonomies)];
return taxonomy;
const taxonomyMap = new Map<string, any>();
taxonomies.forEach((taxonomy) => {
if (!taxonomyMap.has(taxonomy.name)) {
taxonomyMap.set(taxonomy.name, taxonomy);
}
});
return Array.from(taxonomyMap.values());
};

export const getSinglePage = async (collection: any) => {
Expand Down

0 comments on commit 8096fbe

Please sign in to comment.