Skip to content

Commit 7f3573a

Browse files
authored
Merge pull request #3536 from marcelstoer/patch-1
Doc builder template should check for mkdocs_page_input_path before using it
2 parents 66fe4bd + f082ca1 commit 7f3573a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

readthedocs/doc_builder/templates/doc_builder/data.js.tmpl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ var doc_slug = "{{ slug }}";
66
var page_name = "{{ pagename }}";
77
var html_theme = "{{ html_theme }}";
88

9-
READTHEDOCS_DATA["page"] = mkdocs_page_input_path.substr(
10-
0, mkdocs_page_input_path.lastIndexOf(READTHEDOCS_DATA.source_suffix));
9+
// mkdocs_page_input_path is only defined on the RTD mkdocs theme but it isn't
10+
// available on all pages (e.g. missing in search result)
11+
if (typeof mkdocs_page_input_path !== "undefined") {
12+
READTHEDOCS_DATA["page"] = mkdocs_page_input_path.substr(
13+
0, mkdocs_page_input_path.lastIndexOf(READTHEDOCS_DATA.source_suffix));
14+
}

0 commit comments

Comments
 (0)