Skip to content

Commit b5ca1a4

Browse files
authored
KTL-3916 fix: include URL hash in search record paths (#5489)
1 parent e7440a5 commit b5ca1a4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

scripts/dist/lib/search/parsers/writerside.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,15 @@ async function docs($: CheerioAPI, url: string) {
174174
}
175175
}
176176

177+
const resolvedUrl = new URL(finalUrl, pageUrl);
178+
// h1 title has extra anchor with .md which doesn't seem useful here
179+
const resolvedUrlHash = resolvedUrl.hash.endsWith('.md') ? '' : resolvedUrl.hash;
180+
177181
const result: SearchRecord = {
178182
...DEFAULT_RECORD,
179183

180184
objectID: finalUrl,
181-
url: new URL(finalUrl, pageUrl).pathname,
185+
url: resolvedUrl.pathname + resolvedUrlHash,
182186
parent: '/' + url,
183187

184188
headings: headings.reverse().join(' | '),

0 commit comments

Comments
 (0)