Skip to content

Commit

Permalink
docs: Display patch versions in site catalog
Browse files Browse the repository at this point in the history
Consumes the new catalog-v2.json endpoint which provides the
latest patch versions. The latest patch version is now presented
in the version dropdown for the function.

Issues: kptdev/kpt#2609
  • Loading branch information
sdowell committed Dec 9, 2021
1 parent a14e21b commit c491320
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@

let catalogPath;
if (isContribFn) {
catalogPath = "/contrib/catalog.json";
catalogPath = "/contrib/catalog-v2.json";
} else {
catalogPath = "/catalog.json";
catalogPath = "/catalog-v2.json";
}
window.Docsify.get(catalogPath).then(function (
catalogResponse
Expand All @@ -135,8 +135,10 @@
versionName = pathElements[2];
}

const currentVersion = versionName.replaceAll("v", "");
const patchSemver = versions[versionName]['LatestPatchVersion']
const currentVersion = patchSemver.replaceAll("v", "");
const sortedSemvers = Object.keys(versions)
.map((minor) => versions[minor]['LatestPatchVersion'])
.sort((a, b) => compareVersions(a, b))
.reverse();
versionDropdown += `
Expand All @@ -155,7 +157,7 @@
</ol>
</div>`;

const examples = catalog[functionName][versionName];
const examples = catalog[functionName][versionName]['Examples'];
const ghElement = document
.getElementsByClassName("github-corner")
.item(0);
Expand Down

0 comments on commit c491320

Please sign in to comment.