Package: pelican-avatar
Avatar: A Plugin for PelicanThis plugin allows the inclusion ofLibravatarorGravataruser profile pictures, corresponding to the email address of the article's author.InstallationThis plugin can be installed via:python -m pip install pelican-avatarUsageSpecifying the Author's Email AddressThe default email address is taken from theAVATAR_AUTHOR_EMAILvariable in the Pelican settings file. This default value can be overridden on a per-article basis by specifying an email address in the article's metadata:For reStructuredText::email:bart.simpson@example.comFor Markdown:Email: bart.simpson@example.comThe plugin first tries to find an avatar image corresponding to the specified email at Libravatar. If it is not found there, the plugin then searches Gravatar. If an avatar for the specified email address is not found at any of those services, a default picture is shown. The default for the "missing picture" can be defined in the configuration variableAVATAR_MISSING.Adjusting the TemplateThis plugin assigns theauthor_avatarvariable to the avatar image URL and makes that variable available within the article's context. For instance, you can add the following to a template file (for example, to thearticle_infos.htmltemplate file), just before the information about the author:{% if article.author_avatar %}<divalign="center"><imgsrc="{{ article.author_avatar }}"></div>{% endif %}This will yield the following result (with thenotmyideatheme):Page templates work in a similar way:{% if page.author_avatar %}<divalign="center"><imgsrc="{{ page.author_avatar }}"></div>{% endif %}To use in common templates, such asbase.html, you can do something like this:{% if author_avatar %}<divalign="center"><imgsrc="{{ author_avatar }}"></div>{% endif %}Or if you want to support optional overriding of the email address in articles or pages, while still using the global configuration if neither is available:{% if article and article.author_avatar %}
  {% set author_avatar = article.author_avatar %}
{% elif page and page.author_avatar %}
  {% set author_avatar = page.author_avatar %}
{% endif %}
{% if author_avatar %}<divalign="center"><imgsrc="{{ author_avatar }}"></div>{% endif %}ConfigurationThe following variables can be set in the Pelican settings file:AVATAR_AUTHOR_EMAIL: Site-wide default for the author's email address.AVATAR_MISSING: The default for the missing picture. This can be either a URL (e.g.,"http://example.com/nobody.png") or the name of a library of logos (e.g.,"wavatar"; for the full set of alternatives, see theLibravatar API).AVATAR_SIZE: The size, in pixels, of the profile picture (it is always square, so the height is equal to the width). If not specified, the default size (80×80) is returned by Libravatar.AVATAR_USE_GRAVATAR: The plugin looks up avatars via the Libravatar service by default. Searching the Gravatar service can be forced by setting this configuration variable toTrue.CreditsInspiration for this plugin came from theGravatar plugin.ContributingContributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting onexisting issues.To start contributing to this plugin, review theContributing to Pelicandocumentation, beginning with theContributing Codesection.AcknowledgmentsThanks toJustin Mayerfor helping with migration of this plugin under the Pelican Plugins organization and  toTroy Curtisfor adding support for page generator and global generator context and for making improvements in the Poetry workflow.AuthorCopyright (C) 2015, 2021-2023  Rafael Laboissière (rafael@laboissiere.net)LicenseThis project is licensed under the terms of the AGPL 3.0 license.