diff --git a/src/components/Tags.astro b/src/components/Tags.astro index f301a5d..b29462a 100644 --- a/src/components/Tags.astro +++ b/src/components/Tags.astro @@ -1,9 +1,9 @@ --- -const { tags } = Astro.props; +const { tags, all } = Astro.props; --- -

View posts by tag

-

+{all &&

View posts by tag

} +
{ tags && tags.map((tag) => ( @@ -15,4 +15,4 @@ const { tags } = Astro.props; )) } -

+
diff --git a/src/layouts/BlogPost.astro b/src/layouts/BlogPost.astro index f6e2eb7..6753227 100644 --- a/src/layouts/BlogPost.astro +++ b/src/layouts/BlogPost.astro @@ -7,11 +7,31 @@ import Tags from "../components/Tags.astro"; import getTags from "../scripts/getTags"; const posts = await Astro.glob("../posts/*.md"); -const tags = getTags(posts); +const allTags = getTags(posts); -const { - content: { title, description, added, updated, heroImage }, +let { + content: { title, description, added, updated, tags, heroImage }, } = Astro.props; + +added = new Date(added).toLocaleDateString( + "en-us", + { + year: "numeric", + month: "short", + day: "numeric", + } +); + +if (updated) { + updated = new Date(updated).toLocaleDateString( + "en-us", + { + year: "numeric", + month: "short", + day: "numeric", + } + ); +} --- @@ -28,13 +48,14 @@ const { : {added && } } +
- +