Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Commit

Permalink
fix(docsearch): use absolute URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed May 14, 2020
1 parent ed35945 commit e1ed4e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
10 changes: 0 additions & 10 deletions packages/docsearch-react/src/DocSearchModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,6 @@ export function DocSearchModal({
return Object.values(
groupBy(items, (item) => item.hierarchy.lvl1)
)
.map((items) => {
return items.map((item) => {
const url = new URL(item.url);

return {
...item,
url: item.url.replace(url.origin, ''),
};
});
})
.map(transformItems)
.map((hits) =>
hits.map((item) => {
Expand Down
6 changes: 5 additions & 1 deletion packages/website/src/theme/SearchBar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,13 @@ function SearchBar() {
}}
transformItems={(items) => {
return items.map((item) => {
const url = new URL(item.url);

return {
...item,
url: item.url.replace('#__docusaurus', ''),
url: item.url
.replace(url.origin, '')
.replace('#__docusaurus', ''),
};
});
}}
Expand Down

0 comments on commit e1ed4e8

Please sign in to comment.