Skip to content

Commit 99c4970

Browse files
authored
[Docs Site] Fix regression for anchors in search results (#20107)
1 parent 0460570 commit 99c4970

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/plugins/docsearch/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export default {
99
// can be used in local development and previews.
1010
transformItems(items) {
1111
return items.map((item) => {
12-
const path = new URL(item.url).pathname;
13-
const url = new URL(path, window.origin);
12+
const { pathname, hash } = new URL(item.url);
13+
const url = new URL(pathname + hash, window.location.origin);
1414

1515
return {
1616
...item,

0 commit comments

Comments
 (0)