Package Badges (Shields)
AvantiPoint Packages includes built-in support for generating package version badges, similar to shields.io. This makes it easy to display package version information in your documentation, README files, or websites.
Enabling Shields
To enable the shields endpoint, configure a server name in your appsettings.json:
{
"Shields": {
"ServerName": "My Package Feed"
}
}
If ServerName is null or empty, the shields endpoint is disabled and will return a 404.
Using Badges
Once enabled, you can generate badges using the following URL patterns:
https://your-feed.example.com/shield/{packageId}.svg # Latest stable listed version
https://your-feed.example.com/shield/{packageId}/vpre.svg # Latest version including prerelease
In Markdown

Result:
In HTML
<img src="https://your-feed.example.com/shield/MyPackage.svg" alt="Package Version" />
In Documentation Sites
Most documentation generators (MkDocs, DocFX, etc.) support Markdown image syntax:
## MyPackage 
Current version: 
Badge Styles
The shields use a simple, clean design that shows:
- Package name
- Latest version number
- The server name you configured
The color scheme is consistent with standard shields.io badges.
Examples
Single Package
Display the version of a specific package:
### Newtonsoft.Json

Multiple Packages
Create a table of package versions:
| Package | Version |
|---------|---------|
| MyCompany.Core |  |
| MyCompany.Web |  |
| MyCompany.Data |  |
In GitHub README
# My Project


## Installation
```bash
dotnet add package MyCompany.MyPackage
## Comparison with NuGet.org Badges
For packages on NuGet.org, you would typically use shields.io:
```markdown

For packages on your private feed, use the built-in shields:

Authenticated Feeds
If your feed requires authentication, badges may not work in public documentation (like GitHub README files) because browsers won't send credentials.
Solutions:
-
Public metadata - Configure your feed to allow anonymous access to package metadata (but not downloads):
// In your IPackageAuthenticationServicepublic Task<NuGetAuthenticationResult> AuthenticateAsync(string username, string token, CancellationToken cancellationToken){// Allow anonymous access for metadata onlyif (IsMetadataRequest()){return Task.FromResult(NuGetAuthenticationResult.Success(null));}// Require authentication for downloads// ... your authentication logic} -
Separate public metadata endpoint - Deploy a separate, unauthenticated instance that only serves metadata
-
Use in internal docs only - Display badges only in internal documentation that users can authenticate to
Customization
The shield style and colors are currently fixed. If you need custom styling, you have a few options:
- Use shields.io - Generate custom badges with shields.io and point to your feed's metadata endpoint
- Fork and modify - Modify the shield generation code in
AvantiPoint.Packages.Hosting - Proxy through shields.io - Use shields.io's endpoint badge feature to proxy your feed
Disabling Shields
To disable the shields endpoint, remove the ServerName configuration or set it to an empty string:
{
"Shields": {
"ServerName": ""
}
}
Or remove the section entirely:
{
// Shields section removed - endpoint disabled
}
Troubleshooting
Badge shows 404 or error
- Check configuration - Ensure
ServerNameis set - Check package exists - Verify the package is in your feed
- Check URL - Ensure the URL matches
shield/{id}orshield/{id}/vpre(case-sensitive on Linux)
Stable vs Prerelease
- Use
shield/{packageId}.svgfor the latest stable listed version. - Use
shield/{packageId}/vpre.svgto include prerelease versions (e.g.2.0.0-beta.4). - If only prerelease versions exist, the stable badge may be empty or show the latest prerelease depending on listing configuration.
Badge doesn't update
Badges are generated dynamically and should always show the latest version. If you're seeing stale data:
- Clear browser cache - The image may be cached by your browser
- Check CDN cache - If using a CDN, clear its cache
- Add cache-busting parameter - Add a query parameter to force refresh:
### Badge doesn't display in GitHub
GitHub caches images aggressively. To force an update:
1. Commit a change to your README
2. Add a cache-busting parameter to the URL
3. Wait a few minutes for GitHub's cache to update
## See Also
- [Configuration](configuration.md) - Configure AvantiPoint Packages
- [Getting Started](getting-started.md) - Set up your first feed