refactor: update slugify logic inside the component itself

This commit is contained in:
satnaing
2023-05-15 10:05:11 +06:30
parent 7d46181e68
commit e8bd3911b3
+2 -3
View File
@@ -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 />