Gravatar URL’s are generated by creating a hash from your email address. Here we are going to create a liquid-filter for this.

So, Create a gravatar.rb file in your _plugins directory with the following code.

	require 'digest/md5'

	module Jekyll
	  module GravatarFilter
	    def gravatar_url(email)
	      "//www.gravatar.com/avatar/#{hash(email)}?s=150"
	    end

	    private :hash

	    def hash(email)
	      email_address = email ? email.downcase.strip : ''
	      Digest::MD5.hexdigest(email_address)
	    end
	  end
	end

	Liquid::Template.register_filter(Jekyll::GravatarFilter)

So now add an image tag to authors profile and use our liquid filter to generate the md5 hash.

	    <span>
	        <img src="{{ include.author.email | gravatar_url }}" />
	    </span>

Now rebuild the website and you will see your gravatar onto screen.

References