So I have a file, authors.yml, inside my Jekyll _data folder. It's set up like this:
short_name:
name: First Lastname
email: [email protected]
twitter: twitterID
image: image.jpg
bio: 'Bio goes here.'
I'd like to make a listing page of each author in this file. This is what i have tried:
<ul>
{% for author in site.data.authors %}
<li>{{ author.name }}</li>
{% endfor %}
</ul>
What this returns is a number of empty list tags that matches the number of authors in the file.
I'm wondering if there's any way to display the data contained in each author without resorting to the following in the YAML file (as it breaks other code on the site):
-author: short_name
name: First Lastname
email: [email protected]
twitter: twitterID
image: image.jpg
bio: 'Bio goes here.'
Is this possible?
Alternatively, the code that is broken when I add the 'author' key is the following.
In a template:
{% assign author = site.data.authors[post.author] %}
And in a plugin:
entry_name = site.data['authors'][entry.author]