--- import { getCollection } from 'astro:content'; import type { CollectionEntry } from 'astro:content'; import BaseLayout from '@/layouts/BaseLayout.astro'; import Table from '@/components/blog/Table.astro'; import '@/styles/prose.css'; import { Image } from 'astro:assets'; export async function getStaticPaths() { const blogEntries = await getCollection('blog'); return blogEntries .filter((entry) => !entry.data.isDraft) .map((entry) => ({ params: { slug: entry.slug }, props: { entry }, })); } interface Props { entry: CollectionEntry<'blog'>; } const { entry } = Astro.props as Props; const { Content } = await entry.render(); const components = { table: Table }; const { title = '', description = '', author = [], datePublished = '', dateModified = '', image = '', } = entry.data; const formatDate = (dateString: string) => { const date = new Date(dateString); return date.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric', }); }; const descriptionMeta = description.length > 158 ? description.substring(0, 155) + '...' : description; ---

{title}

{ author.length > 0 && ( By{' '} {author.map((a, index) => ( {a.url ? ( {a.name} ) : ( a.name )} {index < author.length - 1 ? ', ' : ''} ))} ) } { datePublished && ( Published on {formatDate(datePublished.toString())} ) } { dateModified && ( Last updated on {formatDate(dateModified.toString())} ) }
{ image && ( {title} ) }