Skip to content

Commit 2664849

Browse files
fix(i18nRedirector): hashを含めるように
1 parent 7e42779 commit 2664849

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

.vitepress/scripts/gen-i18n-redirector.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ts-expect-error Node
21
import fs from 'fs';
32
import { mainLocale, baseUrl } from '../config';
43
import type { SiteConfig } from 'vitepress';
@@ -31,7 +30,7 @@ export async function genI18nRedirector(siteConfig: SiteConfig) {
3130
${linkAlternate}
3231
<link rel="alternate" hreflang="x-default" href="${baseUrl}/${mainLocale}/${routeForRender}">
3332
<link rel="canonical" href="${baseUrl}/${mainLocale}/${routeForRender}">
34-
<script type="text/javascript">const s = ${JSON.stringify(localeNames)}; const d = localStorage.getItem('ais:locale'); if (d) { location.replace('/' + d + location.pathname + location.search); } else if (s.includes(navigator.language.split("-")[0])) { location.replace('/' + navigator.language.split("-")[0] + location.pathname + location.search); } else { location.replace('/ja' + location.pathname + location.search); }</script>
33+
<script type="text/javascript">const s = ${JSON.stringify(localeNames)}; const d = localStorage.getItem('ais:locale'); if (d) { location.replace('/' + d + location.pathname + location.search + location.hash); } else if (s.includes(navigator.language.split("-")[0])) { location.replace('/' + navigator.language.split("-")[0] + location.pathname + location.search + location.hash); } else { location.replace('/ja' + location.pathname + location.search + location.hash); }</script>
3534
</head>
3635
<body>
3736
<noscript>${fallbackLinks}</noscript>

0 commit comments

Comments
 (0)