Skip to content

Commit e23183a

Browse files
committed
Make search compatible with sphinx 2.2.1
We are relying on FILE_SUFFIX, but we were relying on a bug actually sphinx-doc/sphinx#6741 This is compatible with older and new versions. This is also related that we don't save the real full path when indexing. https://github.com/readthedocs/readthedocs.org/blob/24ca737e3f5c0df359801a8dede6519f67a70cb6/readthedocs/search/api.py#L34-L38 Fixes #6801
1 parent 24ca737 commit e23183a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

readthedocs/core/static-src/core/js/doc-embed/search.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ function attach_elastic_search_query(data) {
7777
}
7878

7979
// Creating the result from elements
80-
var link = doc.link + DOCUMENTATION_OPTIONS.FILE_SUFFIX;
80+
var suffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
81+
// Since sphinx 2.2.1 FILE_SUFFIX is .html for all builders,
82+
// and there is a new BUILDER option.
83+
if ('BUILDER' in DOCUMENTATION_OPTIONS && DOCUMENTATION_OPTIONS.BUILDER === 'readthedocsdirhtml') {
84+
var suffix = '';
85+
}
86+
var link = doc.link + suffix;
8187

8288
var item = $('<a>', {'href': link});
8389

0 commit comments

Comments
 (0)