mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:01:42 +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 {
|
export interface Props {
|
||||||
tag: string;
|
tag: string;
|
||||||
|
tagName: string;
|
||||||
size?: "sm" | "lg";
|
size?: "sm" | "lg";
|
||||||
}
|
}
|
||||||
|
|
||||||
const { tag, size = "sm" } = Astro.props;
|
const { tag, tagName, size = "sm" } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<li
|
<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"
|
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>
|
></path>
|
||||||
</svg>
|
</svg>
|
||||||
<span>{tag}</span>
|
<span>{tagName}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,9 @@ const nextPost =
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<main id="main-content">
|
<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
|
<Datetime
|
||||||
pubDatetime={pubDatetime}
|
pubDatetime={pubDatetime}
|
||||||
modDatetime={modDatetime}
|
modDatetime={modDatetime}
|
||||||
@@ -91,7 +93,7 @@ const nextPost =
|
|||||||
</article>
|
</article>
|
||||||
|
|
||||||
<ul class="my-8">
|
<ul class="my-8">
|
||||||
{tags.map(tag => <Tag tag={slugifyStr(tag)} />)}
|
{tags.map(tag => <Tag tag={slugifyStr(tag)} tagName={tag} />)}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@@ -134,10 +136,8 @@ const nextPost =
|
|||||||
stroke-linejoin="round"
|
stroke-linejoin="round"
|
||||||
class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-left flex-none"
|
class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-left flex-none"
|
||||||
>
|
>
|
||||||
<>
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||||
<path d="M15 6l-6 6l6 6" />
|
<path d="M15 6l-6 6l6 6" />
|
||||||
</>
|
|
||||||
</svg>
|
</svg>
|
||||||
<div>
|
<div>
|
||||||
<span>Previous Post</span>
|
<span>Previous Post</span>
|
||||||
@@ -168,10 +168,8 @@ const nextPost =
|
|||||||
stroke-linejoin="round"
|
stroke-linejoin="round"
|
||||||
class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right flex-none"
|
class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right flex-none"
|
||||||
>
|
>
|
||||||
<>
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||||
<path d="M9 6l6 6l-6 6" />
|
<path d="M9 6l6 6l-6 6" />
|
||||||
</>
|
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ let tags = getUniqueTags(posts);
|
|||||||
<Header activeNav="tags" />
|
<Header activeNav="tags" />
|
||||||
<Main pageTitle="Tags" pageDesc="All the tags used in posts.">
|
<Main pageTitle="Tags" pageDesc="All the tags used in posts.">
|
||||||
<ul>
|
<ul>
|
||||||
{tags.map(({ tag }) => <Tag {tag} size="lg" />)}
|
{tags.map(({ tag, tagName }) => <Tag {tag} {tagName} size="lg" />)}
|
||||||
</ul>
|
</ul>
|
||||||
</Main>
|
</Main>
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|||||||
Reference in New Issue
Block a user