--- import BaseLayout from '../../layouts/BaseLayout.astro'; import directus from '../../../lib/directus'; import { readItems } from '@directus/sdk'; const posts = await directus.request( readItems('posts', { fields: ['*'], sort: ['-published_date'], }) ); const sortedPosts = posts.sort((a, b) => b.published_date.valueOf() - a.published_date.valueOf()); // Group posts by year for timeline effect 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

Thoughts, ideas, and explorations on technology and selfhosting.

{ sortedPosts.length > 0 && (
{sortedPosts[0].image && (
{sortedPosts[0].title}
)}
Featured {sortedPosts[0].published_date && ( )}

{sortedPosts[0].title}

{sortedPosts[0].description}

{sortedPosts[0].tags && (
{sortedPosts[0].tags.slice(0, 2).map((tag) => ( {tag} ))}
)}
) }
{ 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}

{post.tags && (
{post.tags.slice(0, 2).map((tag) => ( {tag} ))} {post.tags.length > 2 && ( +{post.tags.length - 2} )}
)}
))}
)) }