This commit is contained in:
2026-03-18 17:37:24 +01:00
parent f6db3ab866
commit eec0df83cd
79 changed files with 2333 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
export default function grabPageName(params) {
const pathArr = params.path.split("/");
const routesIndex = pathArr.findIndex((p) => p == "pages");
const newPathArr = [...pathArr].slice(routesIndex + 1);
const filename = newPathArr
.filter((p) => Boolean(p.match(/./)))
.map((p) => p
.replace(/\.\w+$/, "")
.replace(/\[/g, "-")
.replace(/\.\.\./g, "-")
.replace(/[^a-z\-]/g, ""))
.join("-");
if (filename.endsWith(`-index`)) {
return filename.replace(/-index$/, "");
}
return filename;
}