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:
-
Copy
author-bio.html.twig
and placed attemplates/partials/all-author-bios.html.twig
-
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. -
Add
{% endfor %}
at the end to close the loop. -
Optionally remove lines 12-13:
<p class="author-heading">About the author</p>
<hr />
- Add to the relevant template or (if you have twig processing in pages enabled) in the page markdown:
{% 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:
{% set sorted_authors = config.plugins['aura-authors'].authors|sort_by_key('name') %}
{% for author in sorted_authors %}