index.astro (630B)
1 --- 2 import ContentGrid from '../../layouts/ContentGrid.astro' 3 import TextSection from '../../components/TextSection.astro' 4 5 import { getCollection, getEntry } from 'astro:content' 6 7 const title = 'Photos' 8 9 const photos = await getCollection('photos') 10 11 const photoViewUrl = '/photos/' 12 const photoThumbUrl = '/photos/thumb/' 13 const photoExtension = '.jpg' 14 15 const contentData = photos[0].data.map((photo) => ({ 16 desc: `${photo.date}`, 17 link: `${photoViewUrl}${photo.id}`, 18 image: { 19 link: `${photoThumbUrl}${photo.id}${photoExtension}`, 20 alt: `${photo.desc}`, 21 }, 22 })) 23 --- 24 25 <ContentGrid title={title} content={contentData} />