lukeonline

source for my website
git clone https://git.lukeonline.net/repos/lukeonline
Log | Files | Refs | README | LICENSE

index.astro (582B)


      1 ---
      2 import ContentList from '../../layouts/ContentList.astro'
      3 import TextSection from '../../components/TextSection.astro'
      4 
      5 import { getCollection, getEntry } from 'astro:content'
      6 
      7 const title = 'Blog'
      8 
      9 const posts = await getCollection('blog')
     10 
     11 posts.sort((a, b) => b.data.date.getTime() - a.data.date.getTime())
     12 
     13 const postViewUrl = '/blog/'
     14 
     15 const contentData = posts.map((post) => ({
     16   title: post.data.title,
     17   desc: `${post.data.desc} - ${post.data.date.toDateString()}`,
     18   link: `${postViewUrl}${post.data.slug}`,
     19 }))
     20 ---
     21 
     22 <ContentList title={title} content={contentData} />