In another thread for a different but similar objective that has been solved, @mmistakes suggested I put my total set of “collaborators” data in a single .yml file and pull data from there for a subset of contributors via the front matter of the local .md file. The benefits of this are obvious to me, but I can’t seem to get it to work.
Here’s what I have currently…
# _data/collaborators.yml
doe_jane:
name: "First Last"
affiliation: "Name of Place"
affiliation_url: "URL"
country: "Country"
etc
(Note I’m not pulling the country
value in this particular situation. It’s used for some thing else.)
<!-- _includes/authors.html -->
<section>
<ul>
{% for author in site.data.collaborators %}
<li>{{ author.name }}<sup>{{ forloop.index }}</sup></li>
{% endfor %}
</ul>
<ol>
{% for author in site.data.collaborators %}
<li><sup>{{ forloop.index }}</sup><a href="{{ author.affiliation_url }}">{{ author.affiliation }}</a></li>
{% endfor %}
</ol>
</section>
<!-- local .md file -->
---
collaborators: [doe_jane, jones_jim]
---
...
{% include authors.html %}
But the only thing that outputs is a <sup>
number for every name in the .yml file, which at least tells me the file is being read.
But the problem is that no other data is output, and it does not seem to be filtering out data for only the specified people in the .md front matter, per the example above where I’m just calling Jane and Jim instead of everyone in the file.
I was looking at Jekyll’s Data File examples, but they don’t give an example that describes my situation.
I tried putting the markup that’s in the _includes/authors.html file directly in the local .md file, but the same thing results – no actual data values, and no selection by the indicated names in the .md front matter.
Something’s amiss with the liquid somewhere. Can anyone clarify?