mirror of
https://github.com/Xevion/undefined.behavio.rs.git
synced 2025-12-08 04:08:59 -06:00
Add commas to tags, tune date format
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
---
|
---
|
||||||
import Base from "@layouts/Base.astro";
|
import Base from "@layouts/Base.astro";
|
||||||
import { type CollectionEntry } from 'astro:content';
|
import { type CollectionEntry } from 'astro:content';
|
||||||
|
import { format } from "date-fns";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
post: CollectionEntry<'blog'>;
|
post: CollectionEntry<'blog'>;
|
||||||
}
|
}
|
||||||
const { post } = Astro.props;
|
const { post } = Astro.props;
|
||||||
const { title, pubDate, tags } = post.data;
|
const { title, pubDate, tags } = post.data;
|
||||||
|
const tagCount = tags.length;
|
||||||
---
|
---
|
||||||
<Base title={title}>
|
<Base title={title}>
|
||||||
<div class="max-w-3xl mx-4">
|
<div class="max-w-3xl mx-4">
|
||||||
@@ -15,20 +17,17 @@ const { title, pubDate, tags } = post.data;
|
|||||||
{title}
|
{title}
|
||||||
</a>
|
</a>
|
||||||
</h1>
|
</h1>
|
||||||
|
<p class="mt-0 text-sm ml-5">
|
||||||
<p>
|
|
||||||
<i>
|
|
||||||
<a href={post.slug}>
|
<a href={post.slug}>
|
||||||
<time datetime="{{ page.date | date: '%Y-%m-%dT%H:%M:%SZ' }}">
|
<time class="font-mono" datetime="{{ page.date | date: '%Y-%m-%dT%H:%M:%SZ' }}">
|
||||||
{pubDate}
|
{format(pubDate, "MM-dd-yyyy HH:mm OOO")}
|
||||||
</time>
|
</time>
|
||||||
</a>
|
</a>
|
||||||
<span class="space-x-2">
|
<span class="space-x-2">
|
||||||
{tags.map((tag) => (
|
{tags.map((tag, i) => (
|
||||||
<a href={`/tags/${tag}`}>{ tag }</a>
|
<><a href={`/tags/${tag}`}>{ tag }</a>{ i < tagCount - 1 ? ',' : ''}</>
|
||||||
))}
|
))}
|
||||||
</span>
|
</span>
|
||||||
</i>
|
|
||||||
<article>
|
<article>
|
||||||
<slot />
|
<slot />
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
Reference in New Issue
Block a user