From a56b28bc2c852dc602b9aa44d8c272bf84aea169 Mon Sep 17 00:00:00 2001 From: George Zhao Date: Sat, 8 Feb 2025 12:46:16 +0800 Subject: [PATCH] fix: use tag name for display in tags page (#438) Instead of slugified tags, original tag names will be used for displaying tag names in the tags page. --- src/components/Tag.astro | 5 +++-- src/layouts/PostDetails.astro | 18 ++++++++---------- src/pages/tags/index.astro | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/Tag.astro b/src/components/Tag.astro index 5a4a37664..09d226572 100644 --- a/src/components/Tag.astro +++ b/src/components/Tag.astro @@ -1,10 +1,11 @@ --- export interface Props { tag: string; + tagName: string; size?: "sm" | "lg"; } -const { tag, size = "sm" } = Astro.props; +const { tag, tagName, size = "sm" } = Astro.props; ---
  • -  {tag} +  {tagName}
  • diff --git a/src/layouts/PostDetails.astro b/src/layouts/PostDetails.astro index e295f1a72..496733ad1 100644 --- a/src/layouts/PostDetails.astro +++ b/src/layouts/PostDetails.astro @@ -77,7 +77,9 @@ const nextPost =
    -

    {title}

    +

    + {title} +

      - {tags.map(tag => )} + {tags.map(tag => )}
    - <> - - - + +
    Previous Post @@ -168,10 +168,8 @@ const nextPost = stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right flex-none" > - <> - - - + + ) diff --git a/src/pages/tags/index.astro b/src/pages/tags/index.astro index 97d07b136..5133fc376 100644 --- a/src/pages/tags/index.astro +++ b/src/pages/tags/index.astro @@ -17,7 +17,7 @@ let tags = getUniqueTags(posts);
      - {tags.map(({ tag }) => )} + {tags.map(({ tag, tagName }) => )}