Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ graph LR
[`docs/00-executive-overview.md`](docs/00-executive-overview.md).

## Using the static site
Open [`docs/site/index.html`](docs/site/index.html) to browse a minimal HTML version of the content with navigation and search.
Open [`site/index.html`](site/index.html) to browse a minimal HTML version of the content with navigation and search.
Open [`docs/index.html`](docs/index.html) to browse a minimal HTML version of the content with navigation and search.

## Repo structure
The repository includes:
Expand Down
48 changes: 34 additions & 14 deletions docs/assets/app.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
const pages = [
{ title: "Overview", href: "pages/overview.html" },
{ title: "Service Definition", href: "pages/service-definition.html" },
{ title: "Operating Model", href: "pages/operating-model.html" },
{ title: "Architecture", href: "pages/architecture.html" },
{ title: "KPIs", href: "pages/kpis.html" },
{ title: "Roadmap", href: "pages/roadmap.html" },
{ title: "Runbooks", href: "pages/runbooks.html" },
{ title: "Templates", href: "pages/templates.html" },
{ title: "Hybrid", href: "pages/hybrid.html" }
const pageDefinitions = [
{ title: "Overview", path: "pages/overview.html" },
{ title: "Service Definition", path: "pages/service-definition.html" },
{ title: "Operating Model", path: "pages/operating-model.html" },
{ title: "Architecture", path: "pages/architecture.html" },
{ title: "KPIs", path: "pages/kpis.html" },
{ title: "Roadmap", path: "pages/roadmap.html" },
{ title: "Runbooks", path: "pages/runbooks.html" },
{ title: "Templates", path: "pages/templates.html" },
{ title: "Hybrid", path: "pages/hybrid.html" }
];

function getBasePath() {
let path = window.location.pathname;
if (path.endsWith("/")) {
path = path.slice(0, -1);
}
if (path.endsWith("/index.html")) {
path = path.slice(0, -"/index.html".length);
}
if (path.includes("/pages/")) {
path = path.split("/pages/")[0];
}
return path || "";
}

function resolveHref(targetPath) {
const basePath = getBasePath();
const trimmedBase = basePath.replace(/\/$/, "");
return `${trimmedBase}/${targetPath}`;
}

function buildNav() {
const nav = document.getElementById("nav-links");
pages.forEach((page) => {
pageDefinitions.forEach((page) => {
const link = document.createElement("a");
link.href = page.href;
link.href = resolveHref(page.path);
link.textContent = page.title;
nav.appendChild(link);
});
Expand All @@ -25,14 +45,14 @@ function setupSearch() {
if (!input) return;
input.addEventListener("input", (event) => {
const query = event.target.value.toLowerCase();
const results = pages.filter((page) =>
const results = pageDefinitions.filter((page) =>
page.title.toLowerCase().includes(query)
);
const nav = document.getElementById("nav-links");
nav.innerHTML = "";
results.forEach((page) => {
const link = document.createElement("a");
link.href = page.href;
link.href = resolveHref(page.path);
link.textContent = page.title;
nav.appendChild(link);
});
Expand Down