|
| 1 | +import type { ImageMetadata } from 'astro' |
| 2 | + |
| 3 | +const createCover = (src: string, format: ImageMetadata['format'] = 'jpeg'): ImageMetadata => ({ |
| 4 | + src, |
| 5 | + width: 1200, |
| 6 | + height: 675, |
| 7 | + format, |
| 8 | +}) |
| 9 | + |
1 | 10 | const sampleCollection = [ |
2 | 11 | { |
3 | 12 | id: 'article-one', |
4 | 13 | data: { |
5 | 14 | title: 'Article One', |
6 | 15 | description: 'First test entry', |
7 | | - publishDate: '2024-01-01', |
| 16 | + publishDate: new Date('2024-01-01'), |
8 | 17 | featured: true, |
9 | | - icon: '/icons/one.svg', |
| 18 | + cover: createCover('/_astro/article-one.jpg'), |
| 19 | + coverAlt: 'Cover image for Article One', |
10 | 20 | }, |
11 | 21 | }, |
12 | 22 | { |
13 | 23 | id: 'article-two', |
14 | 24 | data: { |
15 | 25 | title: 'Article Two', |
16 | 26 | description: 'Second test entry', |
17 | | - publishDate: '2024-02-01', |
| 27 | + publishDate: new Date('2024-02-01'), |
18 | 28 | featured: true, |
| 29 | + cover: createCover('/_astro/article-two.jpg'), |
| 30 | + coverAlt: 'Cover image for Article Two', |
19 | 31 | }, |
20 | 32 | }, |
21 | 33 | { |
22 | 34 | id: 'article-three', |
23 | 35 | data: { |
24 | 36 | title: 'Article Three', |
25 | 37 | description: 'Third test entry', |
26 | | - publishDate: '2024-03-01', |
| 38 | + publishDate: new Date('2024-03-01'), |
27 | 39 | featured: false, |
| 40 | + cover: createCover('/_astro/article-three.jpg'), |
| 41 | + coverAlt: 'Cover image for Article Three', |
28 | 42 | }, |
29 | 43 | }, |
30 | 44 | { |
31 | 45 | id: 'article-four', |
32 | 46 | data: { |
33 | 47 | title: 'Article Four', |
34 | 48 | description: 'Fourth test entry', |
35 | | - publishDate: '2024-04-01', |
| 49 | + publishDate: new Date('2024-04-01'), |
36 | 50 | featured: false, |
| 51 | + cover: createCover('/_astro/article-four.jpg'), |
| 52 | + coverAlt: 'Cover image for Article Four', |
37 | 53 | }, |
38 | 54 | }, |
39 | 55 | ] |
|
0 commit comments