--- import { getCollection } from 'astro:content'; import Layout from '../layouts/Layout.astro'; import CustomNav from '../components/CustomNav.astro'; // Get all blog entries and sort by date (newest first) const blogEntries = await getCollection('blog'); const sortedEntries = blogEntries.sort((a, b) => new Date(b.data.date).getTime() - new Date(a.data.date).getTime() ); // Extract unique categories const allCategories = [...new Set(sortedEntries.flatMap(entry => entry.data.categories ? entry.data.categories.split(',').map(cat => cat.trim()) : [] ))]; const title = 'Blog'; const description = 'The latest updates from Jan. See Changelog for more product updates.'; // Define gradient colors for cards const gradients = [ 'from-purple-500 to-pink-500', 'from-blue-500 to-cyan-400', 'from-purple-600 to-blue-500', 'from-cyan-400 to-blue-500', 'from-pink-500 to-purple-600', 'from-blue-600 to-purple-600' ]; --- Blog The latest updates from Jan. See Changelog for more product updates. All Categories Guides Research Building Jan {sortedEntries.map((entry, index) => { const date = new Date(entry.data.date); const formattedDate = date.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }); const gradientClass = gradients[index % gradients.length]; const category = entry.data.categories || 'guides'; return ( {category} {formattedDate} {entry.data.title} {entry.data.description} Read more... ); })}
The latest updates from Jan. See Changelog for more product updates.
{entry.data.description}