Website Carbon Badges
To raise issues, contribute or check out the code, visit the Gitlab repo.
Adding the badge to your site is as simple as inserting the following lines into your markup where you would like the badge to appear:
<div id="wcb" class="wcb carbonbadge"></div> <script src="https://unpkg.com/website-carbon-badges@^1/b.min.js" defer></script>
If you need the badge to work on a dark background, add the class,
.wcb-d to the div container:
<div id="wcb" class="wcb carbonbadge wcb-d"></div> <script src="https://unpkg.com/website-carbon-badges@^1/b.min.js" defer></script>
See a working example here.
To reduce data transfer and server load, the badge caches the result on the user's device and will only make a maximum of one API call per day for each page it is embedded on. If a user visits the same page more than once within a day, the result will have been cached.
To get started:
The build process compresses the
- Further reduce loaded asset size if possible (please send us pull requests if you have ideas on how to do this)