
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
metalsmith-gravatar
Advanced tools
A Metalsmith plugin for Gravatar.
This plugin converts email addresses into their associated Gravatar URLs and adds them to Metalsmith's metadata object.
npm install --save metalsmith-gravatar
If you haven't checked out Metalsmith before, head over to their website and check out the documentation.
If you are using the command-line version of Metalsmith, you can install via npm, and then add the
metalsmith-gravatar key to your metalsmith.json file:
{
"plugins": {
"metalsmith-gravatar": {
"stevenschobert": "spschobert@gmail.com"
}
}
}
If you are using the JavaScript API for Metalsmith, then you can require the module and add it to your
.use() directives:
var gravatar = require('metalsmith-gravatar');
metalsmith.use(gravatar({
stevenschobert: "spschobert@gmail.com"
}));
This plugin will a new metadata property named gravatar. This object will contain all the
Gravatar URLs you can use in your templates:
<img src="{{gravatar.stevenschobert}}" />
Both the CLI and the JavaScript APIs support nested objects. This allows you to group together multiple avatars into named groups!
{
"plugins": {
"metalsmith-gravatar": {
"authors": {
"stevenschobert": "spschobert@gmail.com",
"malcolmreynolds": "mal@firef.ly"
},
"maintainers": {
"core": { ... },
"occasional": { ... }
}
}
}
}
Nested objects map directly into the output'ed gravatar object, so you can access them by the same
names:
<img src="{{gravatar.authors.stevenschobert}}" />
If you want more control over how the Gravatar URLs are generated, you can specify an options
object. If the plugin sees this options object, it will expect the avatars you wish to convert to
be in a new avatars object:
{
"plugins": {
"metalsmith-gravatar": {
"options": {
"protocol": "https"
},
"avatars": {
"stevenschobert": "spschobert@gmail.com",
"authors": { ... }
}
}
}
}
Below is a list of options that are supported:
String - 'http' (default)) or 'https'
Sets the URL prefix for Gravatar images. Useful if you are serving a page via SSL and want to also load the external images via SSL.
Thanks to Segment.io for creating and open-sourcing Metalsmith!
FAQs
A Metalsmith plugin for Gravatar.
We found that metalsmith-gravatar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.

Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.

Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.