doc: do not try to patch #edit-on-github if not found

we add this element in _templates/page.html, which is only used for the
content pages, not in the "search" page. to avoid the js errors, just
disabled it if it's not found.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2020-02-20 13:05:45 +08:00
parent 34b78df480
commit 9d2f6329b7

View File

@ -33,8 +33,10 @@ $(function() {
if (show_edit(branch, data)) {
// patch the edit-on-github URL for correct branch
var url = $("#edit-on-github").attr("href");
url = url.replace("master", branch);
$("#edit-on-github").attr("href", url);
if (url) {
url = url.replace("master", branch);
$("#edit-on-github").attr("href", url);
}
$("#docubetter").show();
}
});