lukeonline - commit 6b3322e
refactor: update expected data structure6b3322ef369d8e7f33fa18271e733bd6d59c1e84Luke Jones<luke.jones.2567@gmail.com>2026-07-21T19:34:39+01:00diff --git a/src/pages/photos/[id].astro b/src/pages/photos/[id].astro
index 068cccc..af2ffa6 100644
--- a/src/pages/photos/[id].astro
+++ b/src/pages/photos/[id].astro
@@ -7,9 +7,9 @@ import { getCollection, render } from "astro:content";
export async function getStaticPaths() {
const photos = await getCollection("photos");
- return photos.map((photo) => ({
+ return photos[0].data.map((photo) => ({
params: {
- id: photo.id,
+ id: photo.id.toString(),
},
props: {
photo,
@@ -22,22 +22,22 @@ const { photo } = Astro.props;
const photoSourceUrl = "/photos/source/";
const photoExtension = ".jpg";
-const photoPath = `${photoSourceUrl}${photo.data.id}${photoExtension}`;
+const photoPath = `${photoSourceUrl}${photo.id}${photoExtension}`;
const tableData = {
- "Location": photo.data.location,
- "Coordinates": photo.data.coordinates,
- "Tags": photo.data.tags
+ "Location": photo.location,
+ "Coordinates": photo.coordinates,
+ "Tags": photo.tags
}
---
-<Base title={photo.data.date}>
+<Base title={photo.date}>
<div class="flex flex-col gap-4">
<a href={photoPath}>
- <img src={photoPath} alt={photo.data.desc} />
+ <img src={photoPath} alt={photo.desc} />
</a>
<div class="flex flex-col gap-1">
- <span>{photo.data.desc}</span>
- <span>{photo.data.date}</span>
+ <span>{photo.desc}</span>
+ <span>{photo.date}</span>
</div>
<div>
<Table rows={tableData} />
diff --git a/src/pages/photos/index.astro b/src/pages/photos/index.astro
index ac28175..315325f 100644
--- a/src/pages/photos/index.astro
+++ b/src/pages/photos/index.astro
@@ -12,12 +12,12 @@ const photoViewUrl = "/photos/";
const photoThumbUrl = "/photos/thumb/";
const photoExtension = ".jpg";
-const contentData = photos.map((photo) => ({
- desc: `${photo.data.date}`,
- link: `${photoViewUrl}${photo.data.id}`,
+const contentData = photos[0].data.map((photo) => ({
+ desc: `${photo.date}`,
+ link: `${photoViewUrl}${photo.id}`,
image: {
- link: `${photoThumbUrl}${photo.data.id}${photoExtension}`,
- alt: `${photo.data.desc}`
+ link: `${photoThumbUrl}${photo.id}${photoExtension}`,
+ alt: `${photo.desc}`
}
}));
---