using astro
Some checks are pending
/ deploy (push) Waiting to run

This commit is contained in:
Loyyd 2026-06-11 08:29:29 +02:00
parent 8e40b8599b
commit 830585e2ba
15 changed files with 5371 additions and 15 deletions

23
src/pages/[...route].ts Normal file
View file

@ -0,0 +1,23 @@
import fs from "node:fs/promises";
import { relativeWebsitePath, routeFromRelativePath, sourcePathFromRoute, walkHtmlFiles } from "../lib/static-pages";
export function getStaticPaths() {
return walkHtmlFiles()
.map(relativeWebsitePath)
.filter((relativePath) => relativePath !== "index.html")
.map((relativePath) => ({
params: {
route: routeFromRelativePath(relativePath),
},
}));
}
export async function GET({ params }: { params: { route?: string } }) {
const html = await fs.readFile(sourcePathFromRoute(params.route), "utf8");
return new Response(html, {
headers: {
"content-type": "text/html; charset=utf-8",
},
});
}