pelican-avatar


Namepelican-avatar JSON
Version 1.0.9 PyPI version JSON
download
home_pageNone
SummaryLibravatar/Gravatar plugin for Pelican
upload_time2024-04-14 11:25:28
maintainerNone
docs_urlNone
authorNone
requires_python<4.0,>=3.8.1
licenseAGPL-3.0
keywords pelican plugin libravatar gravatar
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Avatar: A Plugin for Pelican
============================

[![Build Status](https://img.shields.io/github/actions/workflow/status/pelican-plugins/avatar/main.yml?branch=main)](https://github.com/pelican-plugins/avatar/actions)
[![PyPI Version](https://img.shields.io/pypi/v/pelican-avatar)](https://pypi.org/project/pelican-avatar/)
![License](https://img.shields.io/pypi/l/pelican-avatar?color=blue)

This plugin allows the inclusion of [Libravatar][] or [Gravatar][] user profile pictures, corresponding to the email address of the article's author.

[Libravatar]: http://www.libravatar.org
[Gravatar]: http://www.gravatar.com

Installation
------------

This plugin can be installed via:

    python -m pip install pelican-avatar

Usage
-----

### Specifying the Author's Email Address

The default email address is taken from the `AVATAR_AUTHOR_EMAIL` variable 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:

```rst
:email: bart.simpson@example.com
```

For Markdown:

```markdown
Email: bart.simpson@example.com
```

The 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 variable `AVATAR_MISSING`.

### Adjusting the Template

This plugin assigns the `author_avatar` variable 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 the `article_infos.html` template file), just before the information about the author:

```html
{% if article.author_avatar %}
<div align="center">
        <img src="{{ article.author_avatar }}">
</div>
{% endif %}

```

This will yield the following result (with the [notmyidea][] theme):

![figure](https://github.com/pelican-plugins/avatar/raw/main/avatar-example.png)

[notmyidea]: https://github.com/getpelican/pelican/tree/master/pelican/themes/notmyidea

Page templates work in a similar way:

```html
{% if page.author_avatar %}
<div align="center">
        <img src="{{ page.author_avatar }}">
</div>
{% endif %}
```

To use in common templates, such as `base.html`, you can do something like this:

```html
{% if author_avatar %}
<div align="center">
        <img src="{{ 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:

```html
{% 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 %}
<div align="center">
        <img src="{{ author_avatar }}">
</div>
{% endif %}
```

Configuration
-------------

The 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 the [Libravatar API](https://wiki.libravatar.org/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 to `True`.

Credits
-------

Inspiration for this plugin came from the [Gravatar plugin](https://github.com/getpelican/pelican-plugins/tree/master/gravatar).

Contributing
------------

Contributions 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 on [existing issues][].

To start contributing to this plugin, review the [Contributing to Pelican][] documentation, beginning with the **Contributing Code** section.

[existing issues]: https://github.com/pelican-plugins/avatar/issues
[Contributing to Pelican]: https://docs.getpelican.com/en/latest/contribute.html

Acknowledgments
---------------

Thanks to [Justin Mayer][] for helping with migration of this plugin under the Pelican Plugins organization, to [Troy Curtis][] for adding support for page generator and global generator context and for making improvements in the Poetry workflow, to [Lucas Cimon][] for fixes in the test suit and in the CI support, and to [Christian Clauss][] for Python 3 porting.

[Justin Mayer]: https://github.com/justinmayer
[Troy Curtis]: https://github.com/troycurtisjr
[Lucas Cimon]: https://github.com/Lucas-C
[Christian Clauss]: https://github.com/cclauss

Author
------

Copyright (C) 2015, 2021-2024  Rafael Laboissière (<rafael@laboissiere.net>)

License
-------

This project is licensed under the terms of the AGPL 3.0 license.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pelican-avatar",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8.1",
    "maintainer_email": null,
    "keywords": "pelican, plugin, libravatar, gravatar",
    "author": null,
    "author_email": "=?utf-8?q?Rafael_Laboissi=C3=A8re?= <rafael@laboissiere.net>",
    "download_url": "https://files.pythonhosted.org/packages/38/aa/a657a8109161589993d117b29838e5505b47a7d97aee5032276b79cd31d3/pelican_avatar-1.0.9.tar.gz",
    "platform": null,
    "description": "Avatar: A Plugin for Pelican\n============================\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/pelican-plugins/avatar/main.yml?branch=main)](https://github.com/pelican-plugins/avatar/actions)\n[![PyPI Version](https://img.shields.io/pypi/v/pelican-avatar)](https://pypi.org/project/pelican-avatar/)\n![License](https://img.shields.io/pypi/l/pelican-avatar?color=blue)\n\nThis plugin allows the inclusion of [Libravatar][] or [Gravatar][] user profile pictures, corresponding to the email address of the article's author.\n\n[Libravatar]: http://www.libravatar.org\n[Gravatar]: http://www.gravatar.com\n\nInstallation\n------------\n\nThis plugin can be installed via:\n\n    python -m pip install pelican-avatar\n\nUsage\n-----\n\n### Specifying the Author's Email Address\n\nThe default email address is taken from the `AVATAR_AUTHOR_EMAIL` variable 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:\n\nFor reStructuredText:\n\n```rst\n:email: bart.simpson@example.com\n```\n\nFor Markdown:\n\n```markdown\nEmail: bart.simpson@example.com\n```\n\nThe 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 variable `AVATAR_MISSING`.\n\n### Adjusting the Template\n\nThis plugin assigns the `author_avatar` variable 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 the `article_infos.html` template file), just before the information about the author:\n\n```html\n{% if article.author_avatar %}\n<div align=\"center\">\n        <img src=\"{{ article.author_avatar }}\">\n</div>\n{% endif %}\n\n```\n\nThis will yield the following result (with the [notmyidea][] theme):\n\n![figure](https://github.com/pelican-plugins/avatar/raw/main/avatar-example.png)\n\n[notmyidea]: https://github.com/getpelican/pelican/tree/master/pelican/themes/notmyidea\n\nPage templates work in a similar way:\n\n```html\n{% if page.author_avatar %}\n<div align=\"center\">\n        <img src=\"{{ page.author_avatar }}\">\n</div>\n{% endif %}\n```\n\nTo use in common templates, such as `base.html`, you can do something like this:\n\n```html\n{% if author_avatar %}\n<div align=\"center\">\n        <img src=\"{{ author_avatar }}\">\n</div>\n{% endif %}\n```\n\nOr 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:\n\n```html\n{% if article and article.author_avatar %}\n  {% set author_avatar = article.author_avatar %}\n{% elif page and page.author_avatar %}\n  {% set author_avatar = page.author_avatar %}\n{% endif %}\n{% if author_avatar %}\n<div align=\"center\">\n        <img src=\"{{ author_avatar }}\">\n</div>\n{% endif %}\n```\n\nConfiguration\n-------------\n\nThe following variables can be set in the Pelican settings file:\n\n- `AVATAR_AUTHOR_EMAIL`: Site-wide default for the author's email address.\n\n- `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 the [Libravatar API](https://wiki.libravatar.org/api/)).\n\n- `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\u00d780) is returned by Libravatar.\n\n- `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 to `True`.\n\nCredits\n-------\n\nInspiration for this plugin came from the [Gravatar plugin](https://github.com/getpelican/pelican-plugins/tree/master/gravatar).\n\nContributing\n------------\n\nContributions 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 on [existing issues][].\n\nTo start contributing to this plugin, review the [Contributing to Pelican][] documentation, beginning with the **Contributing Code** section.\n\n[existing issues]: https://github.com/pelican-plugins/avatar/issues\n[Contributing to Pelican]: https://docs.getpelican.com/en/latest/contribute.html\n\nAcknowledgments\n---------------\n\nThanks to [Justin Mayer][] for helping with migration of this plugin under the Pelican Plugins organization, to [Troy Curtis][] for adding support for page generator and global generator context and for making improvements in the Poetry workflow, to [Lucas Cimon][] for fixes in the test suit and in the CI support, and to [Christian Clauss][] for Python 3 porting.\n\n[Justin Mayer]: https://github.com/justinmayer\n[Troy Curtis]: https://github.com/troycurtisjr\n[Lucas Cimon]: https://github.com/Lucas-C\n[Christian Clauss]: https://github.com/cclauss\n\nAuthor\n------\n\nCopyright (C) 2015, 2021-2024  Rafael Laboissi\u00e8re (<rafael@laboissiere.net>)\n\nLicense\n-------\n\nThis project is licensed under the terms of the AGPL 3.0 license.\n",
    "bugtrack_url": null,
    "license": "AGPL-3.0",
    "summary": "Libravatar/Gravatar plugin for Pelican",
    "version": "1.0.9",
    "project_urls": {
        "Funding": "https://donate.getpelican.com/",
        "Homepage": "https://github.com/pelican-plugins/avatar",
        "Issue tracker": "https://github.com/pelican-plugins/avatar/issues"
    },
    "split_keywords": [
        "pelican",
        " plugin",
        " libravatar",
        " gravatar"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9207de3fd8696003b4c1d880a4f62c48b227a3f5dafd12df0bb456f884a4a87d",
                "md5": "0cf049aaae9d3814bd951969732d1d3d",
                "sha256": "1263d74f6132129f027841331a75f702e5c9ba7eeccb0f78389d597f8ed0aef9"
            },
            "downloads": -1,
            "filename": "pelican_avatar-1.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0cf049aaae9d3814bd951969732d1d3d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8.1",
            "size": 18771,
            "upload_time": "2024-04-14T11:25:26",
            "upload_time_iso_8601": "2024-04-14T11:25:26.295272Z",
            "url": "https://files.pythonhosted.org/packages/92/07/de3fd8696003b4c1d880a4f62c48b227a3f5dafd12df0bb456f884a4a87d/pelican_avatar-1.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "38aaa657a8109161589993d117b29838e5505b47a7d97aee5032276b79cd31d3",
                "md5": "1605f916f1544f62bd36303d1f327e30",
                "sha256": "7d0997c45c32b0fbd32a7b18190ae5d11e30fc6eae7530bf68d660c01697ad3a"
            },
            "downloads": -1,
            "filename": "pelican_avatar-1.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "1605f916f1544f62bd36303d1f327e30",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8.1",
            "size": 141955,
            "upload_time": "2024-04-14T11:25:28",
            "upload_time_iso_8601": "2024-04-14T11:25:28.081557Z",
            "url": "https://files.pythonhosted.org/packages/38/aa/a657a8109161589993d117b29838e5505b47a7d97aee5032276b79cd31d3/pelican_avatar-1.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-14 11:25:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pelican-plugins",
    "github_project": "avatar",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pelican-avatar"
}
        
Elapsed time: 0.27470s