Rafael Laboissiere a09f5c6207 libravatar: Encode email address before hashing | 9 yıl önce | |
---|---|---|
.. | ||
test_data | 9 yıl önce | |
.gitignore | 9 yıl önce | |
Readme.md | 9 yıl önce | |
__init__.py | 9 yıl önce | |
libravatar.py | 9 yıl önce | |
test_libravatar.py | 9 yıl önce |
This plugin allows the inclusion of Libravatar user profile pictures, according to the email address of the article's author.
The default email address is taken from the LIBRAVATAR_AUTHOR_EMAIL
variable in the Pelican configuration file. This default value can be
overridden in a per-article basis, according to the email address found in
the article's metadata.
In ReSTructuredText:
:email: bart.simpson@example.com
In Markdown:
Email: bart.simpson@example.com
If the avatar for the specified email address is not found at Libravatar,
it is searched at Gravatar. If it is not found
there neither, a default picture is shown. The default for the "missing
picture" can be defined in the configuration variable LIBRAVATAR_MISSING
.
This plugin assigns the author_libravatar
variable to the Libravatar URL
and makes the variable available within the article's context. For
instance, you can add the following to a template file (for example, to the
article_infos.html
template file of the notmyidea theme), just before the
infomation about the author:
{% if article.author_libravatar %}
<div align="center">
<img src="{{ article.author_libravatar }}">
</div>
{% endif %}
The following variables can be set in the Pelican configuration file:
LIBRAVATAR_AUTHOR_EMAIL
: site-wide default for the author's email address.
LIBRAVATAR_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 alternativas, see
the Libravatar API).
LIBRAVATAR_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.
Inspiration for this plugin came from the gravatar plugin.
Copyright (C) 2015 Rafael Laboissiere (rafael@laboissiere.net)
Released under the GNU Affero Public License, version 3 or later. No warranties.