mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
fix: consider baseUrl
Add baseUrl to search page query URL.
This commit is contained in:
parent
e57294f70f
commit
1298f8c461
1 changed files with 3 additions and 1 deletions
|
@ -7,12 +7,14 @@
|
|||
|
||||
import {useHistory, useLocation} from '@docusaurus/router';
|
||||
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
|
||||
const SEARCH_PARAM_QUERY = 'q';
|
||||
|
||||
function useSearchQuery() {
|
||||
const history = useHistory();
|
||||
const location = useLocation();
|
||||
const {siteConfig: {baseUrl} = {}} = useDocusaurusContext();
|
||||
|
||||
return {
|
||||
searchValue:
|
||||
|
@ -33,7 +35,7 @@ function useSearchQuery() {
|
|||
});
|
||||
},
|
||||
navigateToSearchPage: (searchValue) => {
|
||||
history.push(`/search?q=${searchValue}`);
|
||||
history.push(`${baseUrl}search?q=${searchValue}`);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue