--- 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 tags = [...new Set(posts.flatMap((post) => post.tags || []))].sort(); // Count posts for each tag and create tag objects with additional data const tagObjects = tags.map((tag) => { const count = posts.filter((post) => post.tags?.includes(tag)).length; // Generate a consistent but random-looking hue for each tag const hue = Math.abs(tag.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0) % 360); return { name: tag, count, size: Math.max(1, Math.min(3, Math.floor(count / 2) + 1)), // Size 1-3 based on count hue, }; }); const sortedTags = [...tagObjects].sort((a, b) => b.count - a.count); ---

Explore {' '} Topics

Discover content organized by your interests

{ tags.length === 0 ? (

No tags found yet.

Check back later for categorized content.

) : (

Popular Topics

) }