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;
|
const { post } = Astro.props;
|
||||||
|
|
||||||
let { title, author, description, ogImage, pubDatetime, tags } = post.data;
|
const { title, author, description, ogImage, pubDatetime, tags } = post.data;
|
||||||
tags = tags.map(tag => slugifyStr(tag));
|
|
||||||
|
|
||||||
const { Content } = await post.render();
|
const { Content } = await post.render();
|
||||||
|
|
||||||
@@ -44,7 +43,7 @@ const ogUrl = new URL(ogImage ? ogImage : `${title}.png`, Astro.url.origin)
|
|||||||
</article>
|
</article>
|
||||||
|
|
||||||
<ul class="tags-container">
|
<ul class="tags-container">
|
||||||
{tags.map(tag => <Tag name={tag} />)}
|
{tags.map(tag => <Tag name={slugifyStr(tag)} />)}
|
||||||
</ul>
|
</ul>
|
||||||
</main>
|
</main>
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|||||||
Reference in New Issue
Block a user