Skip to content

Commit

Permalink
feat(theme-default): try to keep current hash across languages
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy committed Jun 14, 2022
1 parent d450478 commit a13c1e7
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -27,6 +27,7 @@ const useNavbarSelectLanguage = (): ComputedRef<ResolvedNavbarItem[]> => {
}
const currentPath = router.currentRoute.value.path
const currentFullPath = router.currentRoute.value.fullPath
const currentHash = router.currentRoute.value.hash
const languageDropdown: ResolvedNavbarItem = {
text: themeLocale.value.selectLanguageText ?? 'unknown language',
Expand Down Expand Up @@ -60,7 +61,8 @@ const useNavbarSelectLanguage = (): ComputedRef<ResolvedNavbarItem[]> => {
if (
router.getRoutes().some((item) => item.path === targetLocalePage)
) {
link = targetLocalePage
// try to keep current hash across languages
link = `${targetLocalePage}${currentHash}`
} else {
link = targetThemeLocale.home ?? targetLocalePath
}
Expand Down

0 comments on commit a13c1e7

Please sign in to comment.