lukeonline - src/pages/blog/index.astro
---
import ContentList from '../../layouts/ContentList.astro'
import TextSection from '../../components/TextSection.astro'
import { getCollection, getEntry } from 'astro:content'
const title = 'Blog'
const posts = await getCollection('blog')
posts.sort((a, b) => b.data.date.getTime() - a.data.date.getTime())
const postViewUrl = '/blog/'
const contentData = posts.map((post) => ({
title: post.data.title,
desc: `${post.data.desc} - ${post.data.date.toDateString()}`,
link: `${postViewUrl}${post.data.slug}`,
}))
---
<ContentList title={title} content={contentData} />