172 lines
4.4 KiB
Plaintext
172 lines
4.4 KiB
Plaintext
---
|
|
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);
|
|
|
|
let routes: any[] = [];
|
|
|
|
pages.forEach((page) => {
|
|
routes.push({ params: { route: page } });
|
|
});
|
|
|
|
return routes;
|
|
}
|
|
|
|
const settings = await getSettings();
|
|
const page = await getPage(settings, Astro.url.pathname);
|
|
|
|
if (page === null || page.page === null) {
|
|
return new Response("Page not found.", {
|
|
status: 404,
|
|
statusText: "Not Found"
|
|
});
|
|
}
|
|
---
|
|
|
|
{ page.page.type === "Webpage" && page.page.exists && (
|
|
<WebpageLayout settings={{
|
|
searchEngine: {
|
|
title: page.page.searchEngine.title,
|
|
description: page.page.searchEngine.description,
|
|
allowCrawlers: page.page.searchEngine.allowCrawlers,
|
|
canonical: page.page.searchEngine.canonical,
|
|
priority: page.page.searchEngine.priority,
|
|
thumbnail: {
|
|
url: page.page.searchEngine.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>
|
|
) }
|