Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit a40e97f

Browse files
authored
Merge pull request #43 from readthedocs/remove-highlight-url-param
Remove 'highlight' URL param from search results
2 parents 4efd3e2 + 3d9f422 commit a40e97f

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

sphinx_search/static/js/rtd_sphinx_search.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,6 @@ const generateSingleResult = (resultData, projectName) => {
341341
</a>';
342342

343343
let page_link = `${resultData.link}${DOCUMENTATION_OPTIONS.FILE_SUFFIX}`;
344-
let page_link_highlight =
345-
page_link + "?highlight=" + encodeURIComponent(SEARCH_QUERY);
346-
347344
let page_title = resultData.title;
348345

349346
// if title is present in highlighted field, use that.
@@ -374,7 +371,7 @@ const generateSingleResult = (resultData, projectName) => {
374371
page_title += "<br>";
375372

376373
content.innerHTML += $u.template(page_link_template, {
377-
page_link: page_link_highlight,
374+
page_link: page_link,
378375
page_title: page_title
379376
});
380377

@@ -386,12 +383,12 @@ const generateSingleResult = (resultData, projectName) => {
386383
if (type === "sections") {
387384
html_structure = get_section_html(
388385
resultData.inner_hits[i],
389-
page_link_highlight
386+
page_link
390387
);
391388
} else if (type === "domains") {
392389
html_structure = get_domain_html(
393390
resultData.inner_hits[i],
394-
page_link_highlight
391+
page_link
395392
);
396393
}
397394
content.innerHTML += html_structure;
@@ -823,6 +820,8 @@ window.addEventListener("DOMContentLoaded", evt => {
823820
search_outer_input.dispatchEvent(event);
824821
}
825822
} else {
826-
console.log("[INFO] Docs are not being served on Read the Docs, readthedocs-sphinx-search will not work.")
823+
console.log(
824+
"[INFO] Docs are not being served on Read the Docs, readthedocs-sphinx-search will not work."
825+
);
827826
}
828827
});

0 commit comments

Comments
 (0)