]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
doc/_static: match with branch encoded in pathname in URL
authorKefu Chai <kchai@redhat.com>
Fri, 20 Nov 2020 04:51:56 +0000 (12:51 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 20 Nov 2020 04:59:22 +0000 (12:59 +0800)
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/<branch-name>/", we should
better match "/en/<branch-name>". in this change,

* do not include the domain name in the pattern to be matched,
  it's not necessary.
* match with "/en/<branch-name>/"

Signed-off-by: Kefu Chai <kchai@redhat.com>
doc/_static/js/ceph.js

index 64107c66ed79ee4ebbc90287a725f784ee2b5374..37e54e5ed99f2349c6f2475c6e21354c13807a84 100644 (file)
@@ -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]
     }