Skip to content

Commit 6782eae

Browse files
louis-preclaude
andcommitted
fix: Keep README.md redirect targets, update validator to handle them
GitBook resolves README.md in redirect targets as directory URLs, so these don't need to be changed. Update the validator to accept foo/README.md when foo.md exists as the page file. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f839d78 commit 6782eae

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

.gitbook.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ redirects:
1616
core-concepts/workspaces/personal-access-tokens: core-concepts/authentication/personal-access-tokens.md
1717
core-concepts/workspaces/client-session-tokens: core-concepts/authentication/client-session-tokens/README.md
1818
core-concepts/workspaces/client-session-tokens/implementing-client-sessions-for-device-management-in-the-backend: core-concepts/authentication/client-session-tokens/implementing-client-sessions-for-device-management-in-the-backend.md
19-
products/access-systems/user-management: capability-guides/access-systems/user-management.md
20-
capability-guides/access-systems/managing-credentials: capability-guides/access-systems/managing-credentials.md
19+
products/access-systems/user-management: capability-guides/access-systems/user-management/README.md
20+
capability-guides/access-systems/managing-credentials: capability-guides/access-systems/managing-credentials/README.md
2121
capability-guides/access-systems/assigning-credentials-to-users: capability-guides/access-systems/managing-credentials/assigning-credentials-to-users.md
2222
products/access-systems/suspending-and-unsuspending-users: capability-guides/access-systems/user-management/suspending-and-unsuspending-users.md
2323
products/seam-bridge-in-development: capability-guides/seam-bridge.md

codegen/validate-redirects.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ function pageExists(fullPath: string): boolean {
4646
if (existsSync(join(fullPath, 'README.md'))) return true
4747
// URL-style target without .md extension (e.g., api/devices → api/devices.md)
4848
if (!fullPath.endsWith('.md') && existsSync(fullPath + '.md')) return true
49+
// README.md targets resolve as directory URLs in GitBook, so check if the
50+
// parent path resolves as a page (e.g., foo/README.md → foo.md).
51+
if (fullPath.endsWith('/README.md')) {
52+
const parentPath = fullPath.slice(0, -'/README.md'.length)
53+
if (existsSync(parentPath + '.md')) return true
54+
}
4955
return false
5056
}
5157

0 commit comments

Comments
 (0)