Skip to content

Commit 5b70b6d

Browse files
committed
Add redirects for legacy documentation URLs
1 parent 7dcc4be commit 5b70b6d

4 files changed

Lines changed: 144 additions & 7 deletions

File tree

docs/public/llms-full.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@
109109
- Release Notes Overview
110110
https://docs.mobileid.ch/release-notes/
111111

112-
- Mobile ID Passkeys Launch (2026-03-23)
113-
https://docs.mobileid.ch/release-notes/posts/2026-03-23-mobile-id-passkeys.html
112+
- Mobile ID Passkeys Launch (2026-03-30)
113+
https://docs.mobileid.ch/release-notes/posts/2026-03-30-mobile-id-passkeys.html
114114

115115

116116
## Additional resources
@@ -7654,9 +7654,9 @@ There are other tools that could come in handy during the development and testin
76547654

76557655
---
76567656

7657-
## Release Notes Mobile ID Passkeys Launch (2026-03-23)
7657+
## Release Notes Mobile ID Passkeys Launch (2026-03-30)
76587658

7659-
Source: https://docs.mobileid.ch/release-notes/posts/2026-03-23-mobile-id-passkeys.html
7659+
Source: https://docs.mobileid.ch/release-notes/posts/2026-03-30-mobile-id-passkeys.html
76607660

76617661

76627662

docs/public/llms.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@
109109
- Release Notes Overview
110110
https://docs.mobileid.ch/release-notes/
111111

112-
- Mobile ID Passkeys Launch (2026-03-23)
113-
https://docs.mobileid.ch/release-notes/posts/2026-03-23-mobile-id-passkeys.html
112+
- Mobile ID Passkeys Launch (2026-03-30)
113+
https://docs.mobileid.ch/release-notes/posts/2026-03-30-mobile-id-passkeys.html
114114

115115

116116
## Additional resources

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"scripts": {
33
"docs:dev": "vitepress dev docs",
4-
"docs:build": "vitepress build docs",
4+
"docs:build": "rm -rf docs/.vitepress/dist && vitepress build docs && node scripts/generate-legacy-redirects.mjs",
55
"docs:preview": "vitepress preview docs"
66
},
77
"devDependencies": {
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
import { mkdirSync, writeFileSync } from 'node:fs'
2+
import path from 'node:path'
3+
4+
const DIST_DIR = path.resolve('docs/.vitepress/dist')
5+
6+
const redirects = new Map()
7+
8+
function addRedirect(from, to) {
9+
redirects.set(from, to)
10+
}
11+
12+
function addSectionRedirects(fromBase, toBase, entries) {
13+
for (const entry of entries) {
14+
const [fromSlug, toSlug = fromSlug] = Array.isArray(entry) ? entry : [entry, entry]
15+
addRedirect(`${fromBase}/${fromSlug}`, `${toBase}/${toSlug}`)
16+
}
17+
}
18+
19+
addSectionRedirects('/reference-guide', '/rest-api-guide', [
20+
'app-provider-client-integration',
21+
'auto-activation',
22+
'best-practices',
23+
'create-client-certs',
24+
'health-status',
25+
'imprint',
26+
'introduction',
27+
'mobile-id-api',
28+
'root-ca-certs',
29+
'status-fault-codes',
30+
])
31+
32+
addSectionRedirects('/oidc', '/oidc-integration-guide', [
33+
'best-practices',
34+
'cloud-integration-guide',
35+
'getting-started',
36+
'imprint',
37+
'introduction',
38+
'message-formats',
39+
'oidc-use-cases',
40+
])
41+
42+
addSectionRedirects('/rig-radius', '/radius-interface-gateway-guide', [
43+
'annexes',
44+
'introduction',
45+
'radius-protocol',
46+
['rig-deployment', 'deployment'],
47+
])
48+
49+
addSectionRedirects('/entraid', '/oidc-integration-guide', [
50+
['external-auth-methods', 'cloud-integration-guide#microsoft-entra-id'],
51+
['getting-started', 'cloud-integration-guide#microsoft-entra-id'],
52+
['imprint', 'cloud-integration-guide#microsoft-entra-id'],
53+
['troubleshooting', 'cloud-integration-guide#troubleshooting'],
54+
])
55+
56+
addSectionRedirects('/entraid-guide', '/oidc-integration-guide', [
57+
['external-auth-methods', 'cloud-integration-guide#microsoft-entra-id'],
58+
['getting-started', 'cloud-integration-guide#microsoft-entra-id'],
59+
['imprint', 'cloud-integration-guide#microsoft-entra-id'],
60+
['troubleshooting', 'cloud-integration-guide#troubleshooting'],
61+
])
62+
63+
addRedirect('/api-reference/api', '/rest-api-guide/api-specification')
64+
addRedirect('/api-reference/openapi-explorer', '/rest-api-guide/api-specification')
65+
addRedirect('/api-reference/mermaid-demo', '/')
66+
addRedirect('/api/', '/rest-api-guide/api-specification')
67+
addRedirect('/api/api', '/rest-api-guide/api-specification')
68+
addRedirect('/rest-api-guide/', '/rest-api-guide/introduction')
69+
addRedirect('/oidc-integration-guide/', '/oidc-integration-guide/introduction')
70+
addRedirect('/radius-interface-gateway-guide/', '/radius-interface-gateway-guide/introduction')
71+
addRedirect('/reference-guide/application-integration', '/rest-api-guide/app-provider-client-integration')
72+
addRedirect('/reference-guide/release-notes', '/release-notes/')
73+
addRedirect('/oidc/coud-integration-guide', '/oidc-integration-guide/cloud-integration-guide')
74+
addRedirect('/radius-interface-gateway-guide/rig-deployment', '/radius-interface-gateway-guide/deployment')
75+
addRedirect('/release-notes/release-notes', '/release-notes/')
76+
addRedirect('/blog/', '/release-notes/')
77+
addRedirect('/blog/posts/2026-03-23-mobile-id-passkeys', '/release-notes/posts/2026-03-30-mobile-id-passkeys')
78+
79+
for (const langSuffix of ['', '.de', '.fr', '.it']) {
80+
addRedirect(
81+
`/release-notes/posts/2026-03-23-mobile-id-passkeys${langSuffix}`,
82+
`/release-notes/posts/2026-03-30-mobile-id-passkeys${langSuffix}`,
83+
)
84+
addRedirect(
85+
`/release-notes/posts/2026-03-28-mobile-id-entra-external-mfa${langSuffix}`,
86+
`/release-notes/posts/2026-03-27-mobile-id-entra-external-mfa${langSuffix}`,
87+
)
88+
}
89+
90+
function renderRedirectHtml(targetPath) {
91+
const escapedTarget = targetPath
92+
.replaceAll('&', '&')
93+
.replaceAll('"', '"')
94+
95+
return `<!doctype html>
96+
<html lang="en">
97+
<head>
98+
<meta charset="utf-8">
99+
<title>Redirecting…</title>
100+
<meta http-equiv="refresh" content="0; url=${escapedTarget}">
101+
<meta name="robots" content="noindex,follow">
102+
<link rel="canonical" href="${escapedTarget}">
103+
<script>
104+
window.location.replace(${JSON.stringify(targetPath)});
105+
</script>
106+
</head>
107+
<body>
108+
<p>This page has moved to <a href="${escapedTarget}">${escapedTarget}</a>.</p>
109+
</body>
110+
</html>
111+
`
112+
}
113+
114+
function writeRedirectFile(relativeFilePath, targetPath) {
115+
const fullPath = path.join(DIST_DIR, relativeFilePath)
116+
mkdirSync(path.dirname(fullPath), { recursive: true })
117+
writeFileSync(fullPath, renderRedirectHtml(targetPath))
118+
}
119+
120+
for (const [fromPath, toPath] of redirects) {
121+
const normalizedFrom = fromPath === '/' ? '/' : fromPath.replace(/\/+$/, '')
122+
123+
if (fromPath.endsWith('/')) {
124+
writeRedirectFile(path.posix.join(normalizedFrom.slice(1), 'index.html'), toPath)
125+
continue
126+
}
127+
128+
if (normalizedFrom.endsWith('.html')) {
129+
writeRedirectFile(normalizedFrom.slice(1), toPath)
130+
continue
131+
}
132+
133+
writeRedirectFile(`${normalizedFrom.slice(1)}.html`, toPath)
134+
writeRedirectFile(path.posix.join(normalizedFrom.slice(1), 'index.html'), toPath)
135+
}
136+
137+
console.log(`Generated ${redirects.size} legacy redirect mappings in ${DIST_DIR}`)

0 commit comments

Comments
 (0)