trying to fix refresh error 500 on project n5 and blog pages

This commit is contained in:
2026-01-31 15:52:31 +01:00
parent 17c1803302
commit 961c6ed372
2 changed files with 29 additions and 11 deletions

View File

@@ -3,18 +3,15 @@
import Content from "$lib/viewport/content.svelte"; import Content from "$lib/viewport/content.svelte";
import { posts, type DevlogPost } from "./devlog/posts"; import { posts, type DevlogPost } from "./devlog/posts";
import Gallery, { type GalleryEntry } from "$lib/lists/gallery.svelte"; import Gallery, { type GalleryEntry } from "$lib/lists/gallery.svelte";
import type { PageProps } from "./$types";
let allEntries: GalleryEntry[] = posts.entries().map(mapEntries).toArray() // let {
// entries,
// }: {
// entries: GalleryEntry[];
// } = $props();
function mapEntries(m: [String, DevlogPost], index: number): GalleryEntry { let { data }: PageProps = $props();
return {
title: `${m[1].title}`,
subtitle: `#${posts.size - index} // ${m[1].date}`,
img: `/projects/projectn5/devlog/${m[0]}/preview.webp`,
link: `/projects/projectn5/devlog/${m[0]}/`,
imgAlt: `Preview image for ${m[1].title}`,
};
}
// Leftpads a single-digit number to two digits // Leftpads a single-digit number to two digits
function leftpad(n: number): String { function leftpad(n: number): String {
@@ -42,5 +39,5 @@
<p>Development log entries in reverse chronological order (newest to oldest).</p> <p>Development log entries in reverse chronological order (newest to oldest).</p>
<Gallery entries={allEntries} reverseTextOrder /> <Gallery entries={data.entries} reverseTextOrder />
</Content> </Content>

View File

@@ -0,0 +1,21 @@
import Gallery, { type GalleryEntry } from "$lib/lists/gallery.svelte";
import { posts, type DevlogPost } from "./devlog/posts";
import type { PageLoad } from './$types';
export const load: PageLoad = ({ params }) => {
let a = posts.entries().map(mapEntries).toArray();
return {
entries: a,
};
};
function mapEntries(m: [String, DevlogPost], index: number): GalleryEntry {
return {
title: `${m[1].title}`,
subtitle: `#${posts.size - index} // ${m[1].date}`,
img: `/projects/projectn5/devlog/${m[0]}/preview.webp`,
link: `/projects/projectn5/devlog/${m[0]}/`,
imgAlt: `Preview image for ${m[1].title}`,
};
}