diff --git a/src/components/ui/Tags.astro b/src/components/ui/Tags.astro index ac564a9..6432375 100644 --- a/src/components/ui/Tags.astro +++ b/src/components/ui/Tags.astro @@ -13,7 +13,7 @@ const { tags, class: className = "text-sm" } = Astro.props; {tags.map((tag) => (
  • #{tag} diff --git a/src/pages/[...slug].astro b/src/pages/[...slug].astro index 33af840..1965de8 100644 --- a/src/pages/[...slug].astro +++ b/src/pages/[...slug].astro @@ -1,6 +1,8 @@ --- import BaseLayout from "@/layouts/BaseLayout.astro"; import Schema from "@/components/seo/Schema.astro"; +import Tags from "@/components/ui/Tags.astro"; +import Categories from "@/components/ui/Categories.astro"; import { getCollection, render } from "astro:content"; @@ -14,7 +16,8 @@ export async function getStaticPaths() { const { post } = Astro.props; const { Content, remarkPluginFrontmatter } = await render(post); -const { title, description, pubDate, author, image } = post.data; +const { title, description, pubDate, author, image, categories, tags } = + post.data; const formattedDate = pubDate.toLocaleDateString("vi-VN", { year: "numeric", @@ -48,6 +51,13 @@ const metadata = {
    + { + categories && categories.length > 0 && ( +
    + +
    + ) + }

    {formattedDate} • {author} {readingTime && ` • ${readingTime}`} @@ -72,6 +82,13 @@ const metadata = { >

    + { + tags && tags.length > 0 && ( +
    + +
    + ) + }
    diff --git a/src/pages/tags/[tag].astro b/src/pages/tag/[tag].astro similarity index 100% rename from src/pages/tags/[tag].astro rename to src/pages/tag/[tag].astro