From 9d2f6329b76f39678a51a13a2f01a6546243f23d Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 20 Feb 2020 13:05:45 +0800 Subject: [PATCH] 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 --- doc/_static/js/ceph.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/_static/js/ceph.js b/doc/_static/js/ceph.js index e8114f0165d..5374029a0a3 100644 --- a/doc/_static/js/ceph.js +++ b/doc/_static/js/ceph.js @@ -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(); } }); -- 2.39.5