From f6552cb74180663fea338eb29be351c2629771bc Mon Sep 17 00:00:00 2001 From: William Mantly Date: Fri, 17 Jul 2026 22:03:52 -0400 Subject: [PATCH] Resolve doc cross-links by real filename as a fallback The new concept docs (and their "See also" reciprocal links) reference each other by real filename -- "concepts-accounts.html" -- which is the correct, working URL on the Jekyll/GitHub Pages build (a page's URL there IS its filename stem), but doesn't match this viewer's own short slugs (DOCS keys, e.g. "accounts" -> /docs/accounts), so fixDocLinks() left those links unrewritten and 404ing in-app. Rather than rewrite the docs to two different link forms depending on target, resolve by filename as a fallback when the slug lookup misses -- one link written in a doc now works correctly on both targets. Bumps to v1.1.13. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01KDEx8ghuZR61pqPXc6da9C --- CHANGELOG.md | 10 ++++++++-- nodejs/package-lock.json | 4 ++-- nodejs/package.json | 2 +- nodejs/routes/docs.js | 14 +++++++++++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c22e4f..622ecc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,12 @@ correspond to git tags (`vX.Y.Z`) and `nodejs/package.json`'s `version`. ## [Unreleased] -## [1.1.12] - 2026-07-17 +## [1.1.13] - 2026-07-17 + +### Fixed +- The new concept docs' cross-links (`concepts-accounts.html` etc.) are the correct, working URL on the Jekyll/GitHub Pages build (where the page's URL is its filename stem) but didn't resolve in the in-app docs viewer, which serves docs at a separate short slug (`/docs/accounts`). The in-app renderer now also resolves a doc's real filename as a fallback, so one link written in a doc works on both targets. + +Bumps to v1.1.13. ### Added - Three new plain-language docs aimed at less technical readers, replacing the schema-level LDAP/OAuth/API docs as the target of most card help links: **Accounts, Groups & Managers**, **Connecting Apps (SSO)**, and **API Tokens**. Each links onward to the deeper technical reference for readers who want it; the technical docs link back the other way too. The personal-access-token card (previously missed) now links to its own doc. @@ -96,7 +101,8 @@ First tagged release. Establishes the `vX.Y.Z` tag convention that the in-app up - Unix/POSIX and LDAP bind-only service account support, distinct from real-person accounts. - Merged OAuth Apps + LDAP Info into a single Integrations page. -[Unreleased]: https://github.com/theta42/sso-manager-node/compare/v1.1.12...HEAD +[Unreleased]: https://github.com/theta42/sso-manager-node/compare/v1.1.13...HEAD +[1.1.13]: https://github.com/theta42/sso-manager-node/compare/v1.1.12...v1.1.13 [1.1.12]: https://github.com/theta42/sso-manager-node/compare/v1.1.11...v1.1.12 [1.1.11]: https://github.com/theta42/sso-manager-node/compare/v1.1.10...v1.1.11 [1.1.10]: https://github.com/theta42/sso-manager-node/compare/v1.1.9...v1.1.10 diff --git a/nodejs/package-lock.json b/nodejs/package-lock.json index 8230fc0..bcee38f 100644 --- a/nodejs/package-lock.json +++ b/nodejs/package-lock.json @@ -1,12 +1,12 @@ { "name": "t42-sso-manager", - "version": "1.1.12", + "version": "1.1.13", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "t42-sso-manager", - "version": "1.1.12", + "version": "1.1.13", "license": "MIT", "dependencies": { "@fortawesome/fontawesome-free": "^7.3.0", diff --git a/nodejs/package.json b/nodejs/package.json index a5a6ef3..e335b31 100755 --- a/nodejs/package.json +++ b/nodejs/package.json @@ -1,6 +1,6 @@ { "name": "t42-sso-manager", - "version": "1.1.12", + "version": "1.1.13", "private": true, "author": [ { diff --git a/nodejs/routes/docs.js b/nodejs/routes/docs.js index 5f9c050..b6e5bb2 100644 --- a/nodejs/routes/docs.js +++ b/nodejs/routes/docs.js @@ -60,10 +60,22 @@ function fixImagePaths(html) { // at /docs/ with no .html suffix. Rewrite known doc links to the // in-app route, same idea as fixImagePaths() above. Only touches slugs that // actually exist, so an unrelated "foo.html" link is left alone. +// Docs are also linked by their real filename stem (e.g. "concepts-accounts.html" +// for docs/concepts-accounts.md) -- the correct, working link on the Jekyll/ +// GitHub Pages build, where the URL IS the filename stem. That doesn't match +// this viewer's own short slugs (DOCS keys, e.g. "accounts"), so also resolve +// by filename as a fallback -- one link written in a doc works correctly on +// both targets, rather than needing two different link forms. +const slugByFilename = Object.fromEntries( + Object.entries(DOCS).map(([slug, d]) => [path.basename(d.file, '.md'), slug]) +); function fixDocLinks(html) { return html .replace(/href="index\.html"/g, 'href="/docs"') - .replace(/href="([a-z0-9-]+)\.html"/g, (match, slug) => DOCS[slug] ? `href="/docs/${slug}"` : match); + .replace(/href="([a-z0-9-]+)\.html"/g, (match, name) => { + const slug = DOCS[name] ? name : slugByFilename[name]; + return slug ? `href="/docs/${slug}"` : match; + }); } // docs/*.md files (not the repo-root README/CHANGELOG/API.md) carry Jekyll