diff --git a/packages/@vuepress/theme-default/components/AlgoliaSearchBox.vue b/packages/@vuepress/theme-default/components/AlgoliaSearchBox.vue index a7a6c0985b..f4ff3ffbd0 100644 --- a/packages/@vuepress/theme-default/components/AlgoliaSearchBox.vue +++ b/packages/@vuepress/theme-default/components/AlgoliaSearchBox.vue @@ -37,7 +37,8 @@ export default { 'facetFilters': [`lang:${lang}`].concat(algoliaOptions.facetFilters || []) }, algoliaOptions), handleSelected: (input, event, suggestion) => { - this.$router.push(new URL(suggestion.url).pathname) + const { pathname, hash } = new URL(suggestion.url) + this.$router.push(`${pathname}${hash}`) } } ))