-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
topic: pluginsRelates to VuePress pluginsRelates to VuePress pluginstype: bugSomething isn't workingSomething isn't working
Description
- I confirm that this is an issue rather than a question.
Bug report
Steps to reproduce
- Have Algolia search setup
- The document website has site config
baseconfigured, for example,/docs. - Search any keyword and click on a search result
- The page will try to navigate to a Url with duplicated base url, In the above, example, will be '/docs/docs/path/to/result.html`.
What is expected?
- The page should navigate to a correct url.
- Or allow user to configure
handleSelectedasalgoliaconfig to overwrite default build-in behavior.
What is actually happening?
On lines around https://github.com/vuejs/vuepress/blob/master/packages/%40vuepress/theme-default/components/AlgoliaSearchBox.vue#L41
handleSelected: (input, event, suggestion) => {
const { pathname, hash } = new URL(suggestion.url)
this.$router.push(`${pathname}${hash}`)
}
If the suggestion url is https://my-domain.com/docs/path/to/result.html`, pathname will be /docs/path/to/result.html. When we use $router.push, the $router will also prepend /docs base url to the path which results in double base url.
Also the handleSelected handling overwrites any configurations on site level algolia config of handleSelected.
Other relevant information
- Output of
npx vuepress infoin my VuePress project:
Environment Info:
System:
OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Binaries:
Node: 8.11.2 - ~/.nvm/versions/node/v8.11.2/bin/node
Yarn: 1.10.1 - ~/.nvm/versions/node/v8.11.2/bin/yarn
npm: 6.4.0 - ~/.nvm/versions/node/v8.11.2/bin/npm
Browsers:
Chrome: 76.0.3809.100
Firefox: 60.8.0
Safari: 12.1.2
npmPackages:
@vuepress/core: 1.0.3
@vuepress/theme-default: 1.0.3
vuepress: ^1.0.3 => 1.0.3
npmGlobalPackages:
vuepress: Not Found
koskimas, florevallatmrf, s-pace and Shipow
Metadata
Metadata
Assignees
Labels
topic: pluginsRelates to VuePress pluginsRelates to VuePress pluginstype: bugSomething isn't workingSomething isn't working