Fixing Javascript issue for sphinx doc pages
authorpixar-oss <pixar-oss@users.noreply.github.com>
Thu, 8 Feb 2024 18:22:18 +0000 (10:22 -0800)
committerpixar-oss <pixar-oss@users.noreply.github.com>
Thu, 8 Feb 2024 18:49:15 +0000 (10:49 -0800)
(Internal change: 2315166)

docs/_static/js/versions.js

index c153fd003b8dce5cf98a2561d3aea52d564b4e34..191db09ebec466af0952ce35bfaaff1e3ae189a0 100644 (file)
     //
     // This file is outside the documentation build; it is expected to live on
     // whatever server is hosting the docs publicly.
-    $.getJSON("../versions.json", function(data) {
-
+    //
+    // NOTE: We look for versions.json relative to the in-use script path
+    // rather than relative to the page path, because pages can now be in 
+    // various subdirs
+    var jsFileLocation = $('script[src*=versions]').attr('src');
+    jsFileLocation = jsFileLocation.replace('versions.js', '');    
+    $.getJSON(jsFileLocation + "../../../versions.json", function(data) {
       var dev_version, release_version
       var all_versions = []
       $.each(data.versions, function(index, entry) {