From 9a6ae27660894de9ceb8d8a089c82d96fbe8262f Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 27 Nov 2023 18:07:14 -0600 Subject: [PATCH] Add commas to tags, tune date format --- src/layouts/Post.astro | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/layouts/Post.astro b/src/layouts/Post.astro index 81e3763..32f3097 100644 --- a/src/layouts/Post.astro +++ b/src/layouts/Post.astro @@ -1,12 +1,14 @@ --- import Base from "@layouts/Base.astro"; import { type CollectionEntry } from 'astro:content'; +import { format } from "date-fns"; interface Props { post: CollectionEntry<'blog'>; } const { post } = Astro.props; const { title, pubDate, tags } = post.data; +const tagCount = tags.length; ---
@@ -15,20 +17,17 @@ const { title, pubDate, tags } = post.data; {title} - -

- +

- - {tags.map((tag) => ( - { tag } + {tags.map((tag, i) => ( + <>{ tag }{ i < tagCount - 1 ? ',' : ''} ))} -