--- import BaseLayout from '../../layouts/BaseLayout.astro'; import FormattedDate from '../../components/FormattedDate.astro'; import TagList from '../../components/TagList.astro'; import directus from '../../lib/directus'; import { readItems } from '@directus/sdk'; const posts = await directus.request( readItems('posts', { fields: ['*'], sort: ['-published_date'], }) ); // Group posts by year for timeline effect const sortedPosts = posts.sort((a, b) => b.published_date.valueOf() - a.published_date.valueOf()); const postsByYear = sortedPosts.reduce((acc, post) => { const year = new Date(post.published_date).getFullYear(); if (!acc[year]) acc[year] = []; acc[year].push(post); return acc; }, {}); const years = Object.keys(postsByYear).sort((a, b) => b - a); ---

Blog

A couple thoughts, a few ideas, and some guides on technology, development, and selfhosting.

{ sortedPosts.length > 0 && (
) }
{ years.map((year) => (

{year}

= 2 ? 'md:grid-cols-2' : 'md:grid-cols-1'} gap-8 sm:gap-12`} > {postsByYear[year].map((post) => (
{post.image && (
{post.title}
)}
{post.pubDate && ( )}

{post.title}

{/* {post.description} */}

))}
)) }