Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Use Aura Authors to generate a list of all authors

Started by paul 6 years ago · 0 replies · 537 views
6 years ago

I recently came across the Aura Authors plugin and wanted to find a way to list all the authors stored in the plugin's config on an "About Us" page.

Just wanted to share how I did it for users like me who aren't skilled with twig. It turned out to be much simpler than I expected:

  1. Copy author-bio.html.twig and placed at templates/partials/all-author-bios.html.twig

  2. Replace line 1: {% set author = authors[page.header.aura.author] %} with {% for author in config.plugins['aura-authors'].authors %}. Now, rather than looking for the author on a given page, the twig loops through all of the authors in the config and renders their bio box.

  3. Add {% endfor %} at the end to close the loop.

  4. Optionally remove lines 12-13:

    TWIG
        <p class="author-heading">About the author</p>
        <hr />
    
  5. Add to the relevant template or (if you have twig processing in pages enabled) in the page markdown:

    TWIG
    {% include 'partials/all-author-bios.html.twig' ignore missing %}
    

You can manually adjust the order the authors appear in Admin > Plugins > Aura Authors, or you can use twig to sort alphabetically. The plugin currently has one single name field without a separate field for surnames. To sort by names, replace the top line edited in step 2 above with the following:

TWIG
{% set sorted_authors = config.plugins['aura-authors'].authors|sort_by_key('name') %}
{% for author in sorted_authors %}

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 43 1 week ago
Plugins · by Xavier, 4 weeks ago
2 53 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1179 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 48 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 72 2 months ago