--- import Layout from '../layouts/Layout.astro'; import FormattedDate from '../components/FormattedDate.astro'; import TagList from '../components/TagList.astro'; import directus from '../../lib/directus'; import { readItems, readSingleton } from '@directus/sdk'; const global = await directus.request(readSingleton('global')); const posts = await directus.request( readItems('posts', { fields: ['*'], sort: ['-published_date'], }) ); const recentPosts = posts .sort((a, b) => b.published_date.getTime() - a.published_date.getTime()) .slice(0, 3); const allTags = [...new Set(posts.flatMap((post) => post.tags || []))].slice(0, 5); --- Writing on technology, development, and selfhosting. {global.about} More about me Recent Posts View all posts { recentPosts.map((post, index) => ( {post.image && ( )} {post.title} {post.description} Read article )) } { allTags.length > 0 && ( Popular Tags {allTags.map((tag) => { const tagCount = posts.filter((post) => post.tags && post.tags.includes(tag)).length; return ( #{tag} {tagCount} {tagCount === 1 ? 'post' : 'posts'} Explore articles about {tag} ); })} ) }
{global.about}
{post.description}
Explore articles about {tag}