Skip to content

Commit 0ac6f48

Browse files
committed
fix: redirect hash path to new path
1 parent 8c87a42 commit 0ac6f48

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ node_modules/
1212
package-lock.json
1313
pnpm-lock.yaml
1414
bun.lockb
15-
16-
tags
15+
bun.lock

.vitepress/theme/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ export default {
1313
// https://vitepress.dev/guide/extending-default-theme#layout-slots
1414
});
1515
},
16-
enhanceApp({ app, router, siteData }) {
17-
// ...
16+
enhanceApp({ router }) {
17+
router.onAfterRouteChange = (to) => {
18+
const hashPath = to.match(/^\/#\/(.+)\/?$/);
19+
if (hashPath) {
20+
console.warn("Hash path is deprecated, redirecting...");
21+
router.go(hashPath[1]);
22+
}
23+
};
1824
},
1925
} satisfies Theme;

0 commit comments

Comments
 (0)