feat: 显示标签和分类的数量

This commit is contained in:
KazooTTT
2025-04-15 17:26:00 +08:00
parent a1fc14d838
commit ec402ffbfe
2 changed files with 4 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import PageLayout from "@/layouts/Base.astro";
const allPosts = await getAllPosts();
const allCategories = getUniqueCategoriesWithCount(allPosts);
const count = allCategories.length;
const meta = {
description: "A list of all the categories I've written about in my posts",
@ -12,7 +13,7 @@ const meta = {
---
<PageLayout meta={meta}>
<h1 class="title mb-6">Categories</h1>
<h1 class="title mb-6">Categories({count})</h1>
<ul class="space-y-4">
{
allCategories.map(([item, val]) => (

View File

@ -4,6 +4,7 @@ import PageLayout from "@/layouts/Base.astro";
const allPosts = await getAllPosts();
const allTags = getUniqueTagsWithCount(allPosts);
const count = allTags.length;
const meta = {
description: "A list of all the topics I've written about in my posts",
@ -12,7 +13,7 @@ const meta = {
---
<PageLayout meta={meta}>
<h1 class="title mb-6">Tags</h1>
<h1 class="title mb-6">Tags({count})</h1>
<ul class="space-y-4">
{
allTags.map(([tag, val]) => (