Add in the loop test for navigable pages, plus test workflow
Some checks failed
Build and Test - Staging / test (pull_request) Failing after 27s
Build and Test - Staging / build_and_push (pull_request) Has been skipped
Build and Test - Staging / deploy_staging (pull_request) Has been skipped

This commit is contained in:
2025-11-09 15:45:15 -08:00
parent 6bb862e6e5
commit 2d7f2904a8
8 changed files with 131 additions and 99 deletions

View File

@@ -116,11 +116,11 @@ export const siteLayout: navLink[] = [
]
},
// {
// title: "Trips",
// navText: "Trips",
// path: "trips",
// children: [
// {title: "2025-08 | Alaska ", path: "2025-08-alaska"},
// {title: "2024-10 | Norway ", path: "2024-10-norway"}
// {navText: "2025-08 | Alaska ", path: "2025-08-alaska"},
// {navText: "2024-10 | Norway ", path: "2024-10-norway"}
// ]
// },
]
@@ -171,4 +171,23 @@ export const pathToMetadata = (path: string): navLink => {
}
return foundEntry;
}
export const getPaths = (
currentEntries: navLink[] = siteLayout,
paths: string[] = []
): string[] => {
let foundPaths: string[] = [];
for (const currentEntry of currentEntries) {
if (currentEntry.children && currentEntry.children.length > 0) {
foundPaths = [
...foundPaths,
...getPaths(currentEntry.children, [...paths, currentEntry.path || ""])
]
} else {
foundPaths.push("/" + [...paths, currentEntry.path || ""].join("/"));
}
}
return foundPaths.filter(path => path !== "/");
}