I want to create a author _layout
that I could use to mount a list of all the author of a Jekyll powered site (in fact, a list of hosts of a podcast). I want this to be at
+ \
+ _posts
+ _includes
+ _layouts
+ _config.yml
+ authors <-- Here
In my Jekyll site, and I already saw that Jekyll render markdown files there.
However, I can't take the authors there and use it to build a list.
I'm using this code
<ul>
{% for post in site.categories.authors %}
<li><a href="{{ site.url }}{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
Any suggestion on how I should do what I want? I want the page to be generate to return the name of the hosts in a list, with links for each of them, like
<a href="/authors/foo">This guy</a>
<a href="/authors/bar">That guy</a>
<a href="/authors/baz">That other guy</a>
And the files to be rendered being at:
+ \
+ _posts
+ _includes
+ _layouts
+ _config.yml
+ authors
+ foo.md
+ bar.md
+ baz.md
If you want to use collections, you will need to configure them properly. But collections is useful when you need to add extra markdown files and you don't want them in _posts
.
Check this answer if you want to go for collections.
But what I believe what you need is Jekyll _data
, not collections.
To do so, create a folder called _data
in the site root
and add file called authors.yml
into that.
Then, you add to authors.yml
the data you want to call:
- ref: 01
name: Name Surname
url: http://something.com
- ref: 02
name: Name Surname 2
url: http://somethingelse.com
Then call them via liquid:
{% for author in site.data.authors %}
<a href="{{ author.url }}">{{ author.name }}</a>
{% endfor %}
I'm sorry if I misunderstood your question.... I really hope to have helped!