Skip to main content
View plugin on GitHub
See starters using this

gatsby-source-gravatar

gatsby-source-gravatar npm downloads npm code style: prettier

Gatsby plugin to source Gravatar URLs from emails.

Install

yarn add gatsby-source-gravatar

# npm install --save gatsby-source-gravatar

How to Configure

module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-gravatar`,
      options: {
        // Required.
        // A list of emails to create URLs for.
        emails: [
          // Could be just a strings,
          `first@example.com`,
          // Or an object, to pass an optional gravatar `query` parameter per email (see below).
          { email: `second@example.com`, query: `?size=128` }
        ]

        // Optional.
        // No query string is passed to gravatar by default.
        // But you can add your gravatar query parameters here.
        // See https://en.gravatar.com/site/implement/images/
        // If this is set, it will be the default for `emails` (see above) with no `query` options.
        query: `?size=64&m=dp`
      }
    }
  ]
}

How to Query

To get the Gravatar URL for one of the configured emails:

{
  gravatar(email: { eq: "first@example.com" }) {
    url
  }
}

To get all Gravatar URLs:

{
  allGravatar {
    edges {
      node {
        url

        # also, available are:
        email
        hash
        query
      }
    }
  }
}

Licence

Made with ♥ in Addis Ababa.

MIT License © 2020 Kaleab S. Melkie.


Docs
Tutorials
Plugins
Blog
Showcase