Skip to content

Commit

Permalink
Merge pull request #3536 from marcelstoer/patch-1
Browse files Browse the repository at this point in the history
Doc builder template should check for mkdocs_page_input_path before using it
  • Loading branch information
davidfischer authored Apr 18, 2018
2 parents 66fe4bd + f082ca1 commit 7f3573a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions readthedocs/doc_builder/templates/doc_builder/data.js.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ var doc_slug = "{{ slug }}";
var page_name = "{{ pagename }}";
var html_theme = "{{ html_theme }}";

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

0 comments on commit 7f3573a

Please sign in to comment.