From: Kefu Chai Date: Fri, 20 Nov 2020 04:51:56 +0000 (+0800) Subject: doc/_static: match with branch encoded in pathname in URL X-Git-Tag: v16.1.0~439^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0980cde33443e4bca1941509747e0ae838e8e444;p=ceph.git doc/_static: match with branch encoded in pathname in URL since we've migrated to RTD, a typical URL of ceph document looks like https://docs.ceph.com/en/octopus/rados/ so instead of match "/docs.ceph.com/docs//", we should better match "/en/". in this change, * do not include the domain name in the pattern to be matched, it's not necessary. * match with "/en//" Signed-off-by: Kefu Chai --- diff --git a/doc/_static/js/ceph.js b/doc/_static/js/ceph.js index 64107c66ed79..37e54e5ed99f 100644 --- a/doc/_static/js/ceph.js +++ b/doc/_static/js/ceph.js @@ -20,8 +20,8 @@ $(function() { } function get_branch() { - var url = window.location.href; - var res = url.match(/docs.ceph.com\/docs\/([a-z]+)\/?/i) + var pathname = window.location.pathname; + var res = pathname.match(/en\/([a-z]+)\/?/i) if (res) { return res[1] }