Update post collection and show category on posts

This commit is contained in:
prototypa
2023-01-24 01:26:37 -05:00
parent c9c555e0ef
commit 64bcda934c
12 changed files with 42 additions and 16 deletions

View File

@@ -5,6 +5,7 @@ import { Picture } from '@astrojs/image/components';
import PostTags from '~/components/blog/Tags.astro';
import SocialShare from '~/components/common/SocialShare.astro';
import { getPermalink } from '~/utils/permalinks';
import { getFormattedDate } from '~/utils/utils';
import type { Post } from '~/types';
@@ -22,8 +23,19 @@ const { post, url } = Astro.props;
<header class={post.image ? '' : ''}>
<div class="flex justify-between flex-col sm:flex-row max-w-3xl mx-auto mt-0 mb-2 px-4 sm:px-6 sm:items-center">
<p>
<Icon name="tabler:clock" class="w-4 h-4 inline-block -mt-1 dark:text-gray-400" />
<Icon name="tabler:clock" class="w-4 h-4 inline-block -mt-0.5 dark:text-gray-400" />
<time datetime={String(post.publishDate)}>{getFormattedDate(post.publishDate)}</time>
{
post.category && (
<>
{' '}
·
<a class="font-bold capitalize" href={getPermalink(post.category, 'category')}>
{post.category.replaceAll('-', ' ')}
</a>
</>
)
}
</p>
</div>
<h1