diff --git a/astro/src/content/blogs/blogs.ts b/astro/src/content/blogs/blogs.ts index 6614d15..69db695 100644 --- a/astro/src/content/blogs/blogs.ts +++ b/astro/src/content/blogs/blogs.ts @@ -94,6 +94,7 @@ export async function getBlog(settings: GlobalSettings, route: string): Promise< const blog: BlogPost = { type: "BlogPost", + exists: true, id: blogRecord["id"], lastModified: new Date(), title: blogRecord["title"], diff --git a/astro/src/content/projects/projects.ts b/astro/src/content/projects/projects.ts index 724c106..24136fa 100644 --- a/astro/src/content/projects/projects.ts +++ b/astro/src/content/projects/projects.ts @@ -24,6 +24,9 @@ export async function getAllProjects(settings: GlobalSettings): Promise + + diff --git a/astro/src/lib/pages.ts b/astro/src/lib/pages.ts index fb46cf4..88c866e 100644 --- a/astro/src/lib/pages.ts +++ b/astro/src/lib/pages.ts @@ -22,6 +22,7 @@ export async function getPage(settings: GlobalSettings, route: string): Promise< pageType: "BlogIndex", page: { type: "BlogIndex", + exists: true, pageNumber: params["page"] !== undefined ? Number(params["page"]) : 1 } }; @@ -63,6 +64,7 @@ export async function getPage(settings: GlobalSettings, route: string): Promise< pageType: "ProjectIndex", page: { type: "ProjectIndex", + exists: true, pageNumber: params["page"] !== undefined ? Number(params["page"]) : 1 } }; @@ -93,7 +95,8 @@ export async function getPage(settings: GlobalSettings, route: string): Promise< route: route, pageType: "PhotoCategoryIndex", page: { - type: "PhotoCategoryIndex" + type: "PhotoCategoryIndex", + exists: true } }; } @@ -114,6 +117,7 @@ export async function getPage(settings: GlobalSettings, route: string): Promise< pageType: "PhotoCategory", page: { type: "PhotoCategory", + exists: true, category: params["category"], pageNumber: params["page"] !== undefined ? Number(params["page"]) : 1 } @@ -160,6 +164,8 @@ export async function getPage(settings: GlobalSettings, route: string): Promise< pageType: "Photo", page: { type: "PhotoPage", + exists: true, + id: photo!.id, photo: photo!.photo, text: photo!.text diff --git a/astro/src/pages/[...route].astro b/astro/src/pages/[...route].astro index 8fad759..ba4fa07 100644 --- a/astro/src/pages/[...route].astro +++ b/astro/src/pages/[...route].astro @@ -22,7 +22,7 @@ export async function getStaticPaths() { const settings = await getSettings(); const page = await getPage(settings, Astro.url.pathname); -if (page === null) { +if (page === null || page.page === null) { return new Response("Page not found.", { status: 404, statusText: "Not Found" @@ -30,16 +30,16 @@ if (page === null) { } --- -{ page.pageType === "Webpage" && ( +{ page.page.type === "Webpage" && page.page.exists && (