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 {useHistory, useLocation} from '@docusaurus/router';
|
||||||
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
||||||
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||||
|
|
||||||
const SEARCH_PARAM_QUERY = 'q';
|
const SEARCH_PARAM_QUERY = 'q';
|
||||||
|
|
||||||
function useSearchQuery() {
|
function useSearchQuery() {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
const {siteConfig: {baseUrl} = {}} = useDocusaurusContext();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
searchValue:
|
searchValue:
|
||||||
|
@ -33,7 +35,7 @@ function useSearchQuery() {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
navigateToSearchPage: (searchValue) => {
|
navigateToSearchPage: (searchValue) => {
|
||||||
history.push(`/search?q=${searchValue}`);
|
history.push(`${baseUrl}search?q=${searchValue}`);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue