Skip to content

Commit 538b1d1

Browse files
committed
possible version switcher fix
1 parent b10fd25 commit 538b1d1

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

docs/.vitepress/config.mts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,29 @@ const guideSidebar = [
8484
},
8585
];
8686

87+
// Script to force hard navigation for version switching links
88+
// VitePress SPA router can't handle navigation between separate VitePress builds
89+
const versionSwitchScript = `
90+
document.addEventListener('click', (e) => {
91+
const link = e.target.closest('a');
92+
if (!link) return;
93+
const href = link.getAttribute('href');
94+
// Check if this is a version switch link (contains /release/ or is ../)
95+
if (href && (href.includes('/release/') || href === '../' || href.endsWith('/release/'))) {
96+
e.preventDefault();
97+
e.stopPropagation();
98+
window.location.href = link.href;
99+
}
100+
}, true);
101+
`;
102+
87103
export default defineConfig({
88104
title: 'B2C DX',
89105
description: 'Salesforce Commerce Cloud B2C Developer Experience - CLI, MCP Server, and SDK',
90106
base: basePath,
91107

108+
head: [['script', {}, versionSwitchScript]],
109+
92110
// Ignore dead links in api-readme.md (links are valid after TypeDoc generates the API docs)
93111
ignoreDeadLinks: [/^\.\/clients\//],
94112

0 commit comments

Comments
 (0)