JM Tech Power

Guides

Show off your project with a badge: stars, version, downloads or licence

← 全部文章 邮箱 RSS Atom

You have seen them at the top of README files: small two-colour labels that say how many stars a project has or which version is current. Every public project on JM Tech Power can have one too, and it keeps itself up to date.

The badge address

A badge is just an image at your project's address with /badge.svg added on the end:

https://jmtechpower.com/<your-handle>/<project-name>/badge.svg

The first part is exactly what your browser shows when you open the project page, so the easiest way is to open your project, copy the address and add /badge.svg.

Choose what it shows

Add ?kind= to pick the badge:

  • ?kind=stars — how many people starred the project (this is also what you get with no kind at all).
  • ?kind=version — the current version, such as v1.2.0.
  • ?kind=downloads — total downloads across all releases.
  • ?kind=license — the licence you chose, such as MIT.

Pick a colour

Add &color= with one of green (the default), blue, grey, orange, red or purple. For example:

https://jmtechpower.com/<your-handle>/<project-name>/badge.svg?kind=version&color=blue

Put it in your README

In Markdown, wrap the image in a link back to the project page so readers can click through:

[![stars](https://jmtechpower.com/<your-handle>/<project-name>/badge.svg)](https://jmtechpower.com/<your-handle>/<project-name>)

On a web page, use an ordinary image inside a link:

<a href="https://jmtechpower.com/<your-handle>/<project-name>"><img src="https://jmtechpower.com/<your-handle>/<project-name>/badge.svg?kind=downloads" alt="downloads"></a>

Good to know

  • Badges refresh by themselves. Each one may be cached for about five minutes, so a new star or release can take a moment to show.
  • Only public projects have a working badge. For a private project, everyone else sees a red not found badge, so your README never reveals a project you have not shared.
  • Badges are plain images with no scripts and no tracking, so they are safe to embed anywhere images are allowed.

Not published anything yet? The guide Publish your software in one step walks you through it, and your projects are always on My projects.

评论 (0)

暂无评论,成为第一个评论者!