mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
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.
This commit is contained in:
@@ -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;
|
||||
---
|
||||
|
||||
<li
|
||||
@@ -24,7 +25,7 @@ const { tag, size = "sm" } = Astro.props;
|
||||
d="M16.018 3.815 15.232 8h-4.966l.716-3.815-1.964-.37L8.232 8H4v2h3.857l-.751 4H3v2h3.731l-.714 3.805 1.965.369L8.766 16h4.966l-.714 3.805 1.965.369.783-4.174H20v-2h-3.859l.751-4H21V8h-3.733l.716-3.815-1.965-.37zM14.106 14H9.141l.751-4h4.966l-.752 4z"
|
||||
></path>
|
||||
</svg>
|
||||
<span>{tag}</span>
|
||||
<span>{tagName}</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -77,7 +77,9 @@ const nextPost =
|
||||
</button>
|
||||
</div>
|
||||
<main id="main-content">
|
||||
<h1 transition:name={slugifyStr(title)} class="post-title inline-block">{title}</h1>
|
||||
<h1 transition:name={slugifyStr(title)} class="post-title inline-block">
|
||||
{title}
|
||||
</h1>
|
||||
<Datetime
|
||||
pubDatetime={pubDatetime}
|
||||
modDatetime={modDatetime}
|
||||
@@ -91,7 +93,7 @@ const nextPost =
|
||||
</article>
|
||||
|
||||
<ul class="my-8">
|
||||
{tags.map(tag => <Tag tag={slugifyStr(tag)} />)}
|
||||
{tags.map(tag => <Tag tag={slugifyStr(tag)} tagName={tag} />)}
|
||||
</ul>
|
||||
|
||||
<div
|
||||
@@ -134,10 +136,8 @@ const nextPost =
|
||||
stroke-linejoin="round"
|
||||
class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-left flex-none"
|
||||
>
|
||||
<>
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M15 6l-6 6l6 6" />
|
||||
</>
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M15 6l-6 6l6 6" />
|
||||
</svg>
|
||||
<div>
|
||||
<span>Previous Post</span>
|
||||
@@ -168,10 +168,8 @@ const nextPost =
|
||||
stroke-linejoin="round"
|
||||
class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right flex-none"
|
||||
>
|
||||
<>
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M9 6l6 6l-6 6" />
|
||||
</>
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M9 6l6 6l-6 6" />
|
||||
</svg>
|
||||
</a>
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ let tags = getUniqueTags(posts);
|
||||
<Header activeNav="tags" />
|
||||
<Main pageTitle="Tags" pageDesc="All the tags used in posts.">
|
||||
<ul>
|
||||
{tags.map(({ tag }) => <Tag {tag} size="lg" />)}
|
||||
{tags.map(({ tag, tagName }) => <Tag {tag} {tagName} size="lg" />)}
|
||||
</ul>
|
||||
</Main>
|
||||
<Footer />
|
||||
|
||||
Reference in New Issue
Block a user