mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
refactor: update slugify logic inside the component itself
This commit is contained in:
@@ -13,8 +13,7 @@ export interface Props {
|
||||
|
||||
const { post } = Astro.props;
|
||||
|
||||
let { title, author, description, ogImage, pubDatetime, tags } = post.data;
|
||||
tags = tags.map(tag => slugifyStr(tag));
|
||||
const { title, author, description, ogImage, pubDatetime, tags } = post.data;
|
||||
|
||||
const { Content } = await post.render();
|
||||
|
||||
@@ -44,7 +43,7 @@ const ogUrl = new URL(ogImage ? ogImage : `${title}.png`, Astro.url.origin)
|
||||
</article>
|
||||
|
||||
<ul class="tags-container">
|
||||
{tags.map(tag => <Tag name={tag} />)}
|
||||
{tags.map(tag => <Tag name={slugifyStr(tag)} />)}
|
||||
</ul>
|
||||
</main>
|
||||
<Footer />
|
||||
|
||||
Reference in New Issue
Block a user