Skip to content

Commit

Permalink
Fixes uri
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonb5 committed Apr 17, 2024
1 parent b3a36cf commit 98d8d65
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions doc/source/_templates/versions.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@
{# Add rst-badge after rst-versions for small badge style. #}
<script type="text/javascript">
let baseUriRegex = /(.*\/cime).*/g;
let baseUri = baseUriRegex.exec(document.baseURI);
let parsedUri = baseUriRegex.exec(document.baseURI);

$.get(`${baseUri}/versions/versions.json`, function(data) {
let versionElement = $("#versions");
if (parsedUri != null && parsedUri.length == 2) {
let baseUri = parsedUri[0];

Object.keys(data).forEach(function(key) {
let value = data[key];
$.get(`${baseUri}/versions/versions.json`, function(data) {
let versionElement = $("#versions");

let item = `<dd><a href="${baseUri[1]}/versions/${key}/html/">${value}</a></dd>`
Object.keys(data).forEach(function(key) {
let value = data[key];

versionElement.append(item);
let item = `<dd><a href="${baseUri}/versions/${key}/html/">${value}</a></dd>`

versionElement.append(item);
});
});
});
}
</script>
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
Expand Down

0 comments on commit 98d8d65

Please sign in to comment.