fix(router): keep html entrypoints working

This commit is contained in:
2026-05-27 21:20:15 +02:00
parent ca4f849dda
commit 64191eb054
+9
View File
@@ -1,9 +1,14 @@
(() => { (() => {
const main = document.getElementById("app-main"); const main = document.getElementById("app-main");
const footerYear = document.getElementById("footer-year");
const pageStyleSelectors = "[data-page-style='true']"; const pageStyleSelectors = "[data-page-style='true']";
const links = Array.from(document.querySelectorAll("[data-route]")); const links = Array.from(document.querySelectorAll("[data-route]"));
if (footerYear) {
footerYear.textContent = new Date().getFullYear().toString();
}
function clearInjectedPageStyles() { function clearInjectedPageStyles() {
document.querySelectorAll(pageStyleSelectors).forEach((node) => node.remove()); document.querySelectorAll(pageStyleSelectors).forEach((node) => node.remove());
} }
@@ -59,6 +64,10 @@
const path = window.location.pathname.replace(/^\/+|\/+$/g, ""); const path = window.location.pathname.replace(/^\/+|\/+$/g, "");
if (path) { if (path) {
if (path.endsWith(".html")) {
return "index";
}
const parts = path.split("/"); const parts = path.split("/");
if (parts[0] === "p" && parts[1]) { if (parts[0] === "p" && parts[1]) {
return normalizeRoute(parts.slice(1).join("/")); return normalizeRoute(parts.slice(1).join("/"));