Skip to content

Commit 4b67fe5

Browse files
authored
V2: Add urlObject.hash to linker.toLinkForContent (#3246)
1 parent 938125e commit 4b67fe5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/thin-buckets-grow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gitbook-v2": patch
3+
---
4+
5+
Add `urlObject.hash` to `linker.toLinkForContent` to pass through URL fragment identifiers, used in search

packages/gitbook-v2/src/lib/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export function getBaseContext(input: {
165165
// Create link in the same format for links to other sites/sections.
166166
linker.toLinkForContent = (rawURL: string) => {
167167
const urlObject = new URL(rawURL);
168-
return `/url/${urlObject.host}${urlObject.pathname}${urlObject.search}`;
168+
return `/url/${urlObject.host}${urlObject.pathname}${urlObject.search}${urlObject.hash}`;
169169
};
170170
}
171171

0 commit comments

Comments
 (0)