使用 shields.io 產生 nuget 套件版本徽章 badge

在 GitHub 中我們很常會看到這樣的「徽章(badge)」,可以顯示 nuget 套件當前的版本,要怎麼產生這個徽章呢?

這個徽章是使用 shields.io 產生的,只要開啟 shields.io 的 NuGet Version 頁面,選擇穩定版的 v 或是包含預覽版的 vpre ,輸入套件名稱就可以了:

將下方產生的內容複製到 GitHub 儲存庫中的 README.md 檔案中即可:
    
![NuGet Version](https://img.shields.io/nuget/vpre/AutoServiceRegistration.AspNetCore)
    

不過這樣做出來的圖片點選後會跳到一個網頁,這個網頁內容就只有這張圖片。

所以我們可以使用 markdown 語法,將這個圖片外面再包一層連結,讓這個圖片被點選後可以跳至 nuget.org 頁面:
    
[![NuGet version (AutoServiceRegistration.AspNetCore)](https://img.shields.io/nuget/v/AutoServiceRegistration.AspNetCore)](https://www.nuget.org/packages/AutoServiceRegistration.AspNetCore)
    



參考資料:
Shields.io

留言