On websites where the author of an article may vary, many sites include a quick blurb about the author with the article. This blurb will typically be at the start of the article or the end of the article, and provides extra information for readers on the author.

Elegant provides this feature, adding a section for any recognized articles at the end of the article.

Here are two examples of what the Author Blurbs may look like:

Author Blurb 1

Author Blurb 2

Configuration

To enable author blurbs for your articles, you need to define an AUTHORS configuration variable in your Pelican configuration. The AUTHORS configuration variable for the Elegant documentation website is specified as follows:

AUTHORS = {
    "Talha Mansoor": {
        "url": "https://www.oncrashreboot.com/",
        "blurb": "is the creator and lead developer of Elegant theme.",
        "avatar": "/images/avatars/talha131.png",
    },
    "Pablo Iranzo Gómez": {
        "url": "http://iranzo.github.io",
        "blurb": " opensource enthusiast and Lego fan doing some python simple programs like @redken_bot in telegram, etc",
        "avatar": "https://avatars.githubusercontent.com/u/312463",
    },
    "Jack De Winter": {
        "url": "http://jackdewinter.github.io",
        "blurb": "ever evolving, ever learning",
    },
}

The value assigned to the configuration variable is a Python dictionary1 containing one key-value pair for every author. The key for the key-value pair is the name of the author as you want it to appear at the end of the article. In the example, the three authors are “Talha Mansoor”, “Pablo Iranzo Gómez”, and “Jack De Winter”.

The value for each of the key-value pairs is another dictionary. Elegant specifically looks for these three keys in the each author’s dictionary:

  • url (string) URL to the author’s homepage or profile
  • blurb (string) Introduction of author
  • avatar (string) URL to author’s avatar image

For the url and avatar values, there is no restriction on where the URL links to. In the above example, Talha’s avatar URL is local, while Pablo’s URL is remote.

Article Metadata

While the configuration for Author Blurbs is centralized in the configuration file, enabling this feature for a given article requires that the article contains either the author or authors metadata field values. If neither of these values are provided, the AUTHOR configuration variable will be used as a default.

AUTHOR = 'Pablo Iranzo Gómez'

The default AUTHOR configuration variable and the author metadata field both denote a single author. The authors metadata field denotes multiple authors using a comma separated list.

For each author determined through in this manner, a check is performed against the AUTHORS configuration in the previous section on Configuration. If the author is found using a case-sensitive exact match, a blurb will be generated for that author. If the author is not found, it will be silently ignored.

A good example of the authors metadata field is available by looking at the raw Markdown for this page.

Authors: Talha Mansoor, Jack De Winter

Common Mistake

A frequent mistake is to define multiple authors, but assign the value to the author metadata field. This can happen easily if one author writes the original version of the article and another author updates or changes that article. This mistake causes Elegant to look for that single author using the entire text for that value.

The correct way to do this is to use authors metadata field.


  1. For more information on Python dictionaries, refer to this comprehensive article on Python dictionaries

Like this post? Share on: TwitterFacebookEmail


Talha Mansoor Avatar Talha Mansoor is the creator and lead developer of Elegant theme.
Jack De Winter ever evolving, ever learning

Keep Reading


Published

Last Updated

Category

Supported Plugins

Tags

Stay in Touch

Get New Release Alert