Add page types, index components, and layout

This commit is contained in:
itsfinniii
2026-03-20 16:40:21 +01:00
parent cb4cb9e578
commit 4bb3fa3671
8 changed files with 258 additions and 42 deletions

View File

@@ -3,27 +3,169 @@ import { getAllRoutesList } from "@/lib/routing";
import { getPage } from "@/lib/pages";
import { getSettings } from "@/content/settings/settings"
import WebpageLayout from "@/layouts/WebpageLayout.astro";
import BlogIndex from "@/components/blogs/BlogIndex.astro";
import ProjectIndex from "@/components/projects/ProjectIndex.astro";
export async function getStaticPaths() {
const settings = await getSettings();
const pages = await getAllRoutesList(settings);
console.log(pages);
let routes: any[] = [];
pages.forEach((page) => {
routes.push({ params: { route: page } });
})
});
return routes;
}
const settings = await getSettings();
const routes = await getAllRoutesList(settings);
const page = await getPage(settings, "/album/2026/mirai-nexus-2026/6c0e4453ab");
const page = await getPage(settings, Astro.url.pathname);
if (page === null) {
return new Response("Page not found.", {
status: 404,
statusText: "Not Found"
});
}
---
<WebpageLayout>
<h1>Test</h1>
</WebpageLayout>
{ page.pageType === "Webpage" && (
<WebpageLayout settings={{
searchEngine: {
title: "",
description: "",
allowCrawlers: true,
canonical: null,
priority: 65,
thumbnail: {
url: "",
width: 1200,
height: 630
}
}}}>
<Fragment slot="content">
<div>Webpage</div>
</Fragment>
</WebpageLayout>
) }
{ page.pageType === "BlogIndex" && (
<WebpageLayout settings={{
searchEngine: {
title: "Blogs",
description: "",
allowCrawlers: true,
canonical: null,
priority: 65,
thumbnail: {
url: "",
width: 1200,
height: 630
}
}}}>
<Fragment slot="content">
<BlogIndex page={page.page as BlogIndex} />
</Fragment>
</WebpageLayout>
) }
{ page?.pageType === "BlogPost" && (
<WebpageLayout settings={{
searchEngine: {
title: "Blogs",
description: "",
allowCrawlers: true,
canonical: null,
priority: 65,
thumbnail: {
url: "",
width: 1200,
height: 630
}
}}}>
<Fragment slot="content">
<dib>BlogPost</dib>
</Fragment>
</WebpageLayout>
) }
{ page.pageType === "ProjectIndex" && (
<WebpageLayout settings={{
searchEngine: {
title: "Projects",
description: "",
allowCrawlers: true,
canonical: null,
priority: 65,
thumbnail: {
url: "",
width: 1200,
height: 630
}
}}}>
<Fragment slot="content">
<ProjectIndex page={page.page as ProjectIndex} />
</Fragment>
</WebpageLayout>
) }
{ page.pageType === "ProjectPost" && (
<WebpageLayout settings={{
searchEngine: {
title: "Projects",
description: "",
allowCrawlers: true,
canonical: null,
priority: 65,
thumbnail: {
url: "",
width: 1200,
height: 630
}
}}}>
<Fragment slot="content">
<div>ProjectPost</div>
</Fragment>
</WebpageLayout>
) }
{ page.pageType === "PhotoCategoryIndex" && (
<WebpageLayout settings={{
searchEngine: {
title: "Projects",
description: "",
allowCrawlers: true,
canonical: null,
priority: 65,
thumbnail: {
url: "",
width: 1200,
height: 630
}
}}}>
<Fragment slot="content">
<div>PhotoCategoryIndex</div>
</Fragment>
</WebpageLayout>
) }
{ page.pageType === "Photo" && (
<WebpageLayout settings={{
searchEngine: {
title: "Projects",
description: "",
allowCrawlers: true,
canonical: null,
priority: 65,
thumbnail: {
url: "",
width: 1200,
height: 630
}
}}}>
<Fragment slot="content">
<div>Photo</div>
</Fragment>
</WebpageLayout>
) }