eleventy-plugin-gravatar

1.0.1 • Public • Published

Eleventy Plugin for Gravatar

This plugin adds a gravatarUrl filter which allows you to easily convert an email address into the associated Gravatar image URL. It also allows you to specify what size image you would like to use.

Installing the Plugin

In your Eleventy project: npm install --save-dev eleventy-plugin-gravatar

In your .eleventy.js configuration file, import the plugin, and pass it to Eleventy's addPlugin method:

const gravatarPlugin = require('eleventy-plugin-gravatar');
 
module.exports = (eleventyConfig) => {
  eleventyConfig.addPlugin(gravatarPlugin);
};

Usage Examples

Examples for Liquid and Nunjucks templates are provided below. For other templating languages, consult the documentation for Eleventy or your template language.

Liquid

<!-- Default avatar size -->
<img src="{{ authorEmail | gravatarUrl }}" />
 
<!-- Avatar of 15x15 pixels -->
<img src="{{ authorEmail | gravatarUrl: 15}}" />

Nunjucks

<!-- Default avatar size -->
<img src="{{ authorEmail | gravatarUrl }}" />
 
<!-- Avatar of 15x15 pixels -->
<img src="{{ authorEmail | gravatarUrl(15) }}" />

Package Sidebar

Install

npm i eleventy-plugin-gravatar

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

1.83 kB

Total Files

3

Last publish

Collaborators

  • joshuacc