fix(router): keep html entrypoints working
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
(() => {
|
||||
const main = document.getElementById("app-main");
|
||||
const footerYear = document.getElementById("footer-year");
|
||||
const pageStyleSelectors = "[data-page-style='true']";
|
||||
|
||||
const links = Array.from(document.querySelectorAll("[data-route]"));
|
||||
|
||||
if (footerYear) {
|
||||
footerYear.textContent = new Date().getFullYear().toString();
|
||||
}
|
||||
|
||||
function clearInjectedPageStyles() {
|
||||
document.querySelectorAll(pageStyleSelectors).forEach((node) => node.remove());
|
||||
}
|
||||
@@ -59,6 +64,10 @@
|
||||
|
||||
const path = window.location.pathname.replace(/^\/+|\/+$/g, "");
|
||||
if (path) {
|
||||
if (path.endsWith(".html")) {
|
||||
return "index";
|
||||
}
|
||||
|
||||
const parts = path.split("/");
|
||||
if (parts[0] === "p" && parts[1]) {
|
||||
return normalizeRoute(parts.slice(1).join("/"));
|
||||
|
||||
Reference in New Issue
Block a user