Skip to content

Commit 6826a71

Browse files
Dynamically display latest version in badge
Replaces the static version badge with a dynamic fetch from NuGet to show the latest released version. Falls back to v1.1.1 if the fetch fails.
1 parent ece3736 commit 6826a71

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

csv.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@
815815
<section class="hero">
816816
<div class="badge">
817817
<span class="badge-dot"></span>
818-
<span>v1.1.1 Released</span>
818+
<span id="version-badge">Loading...</span>
819819
</div>
820820

821821
<h1>
@@ -1400,6 +1400,18 @@ <h2>Ready to get started?</h2>
14001400
}
14011401
});
14021402
});
1403+
1404+
// Fetch latest version from NuGet
1405+
fetch('https://api.nuget.org/v3-flatcontainer/dataplat.dbatools.csv/index.json')
1406+
.then(response => response.json())
1407+
.then(data => {
1408+
const versions = data.versions;
1409+
const latest = versions[versions.length - 1];
1410+
document.getElementById('version-badge').textContent = `v${latest} Released`;
1411+
})
1412+
.catch(() => {
1413+
document.getElementById('version-badge').textContent = 'v1.1.1 Released';
1414+
});
14031415
</script>
14041416
</body>
14051417
</html>

0 commit comments

Comments
 (0)