trying to fix refresh error 500 on project n5 and blog pages
This commit is contained in:
@@ -3,18 +3,15 @@
|
||||
import Content from "$lib/viewport/content.svelte";
|
||||
import { posts, type DevlogPost } from "./devlog/posts";
|
||||
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 {
|
||||
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}`,
|
||||
};
|
||||
}
|
||||
let { data }: PageProps = $props();
|
||||
|
||||
// Leftpads a single-digit number to two digits
|
||||
function leftpad(n: number): String {
|
||||
@@ -42,5 +39,5 @@
|
||||
|
||||
<p>Development log entries in reverse chronological order (newest to oldest).</p>
|
||||
|
||||
<Gallery entries={allEntries} reverseTextOrder />
|
||||
<Gallery entries={data.entries} reverseTextOrder />
|
||||
</Content>
|
||||
21
src/routes/projects/projectn5/+page.ts
Normal file
21
src/routes/projects/projectn5/+page.ts
Normal 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}`,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user