I’m trying to display a list of items from collections on a website. I’d like to use one layout and write in the front matter the name of the category so it displays in the page the name and URL of every pages belonging to this collection.
This is my code at the moment:
{% for collection_name in site.collection_names %}
<li>
<a href="{{ collection_name.url }}" class="btn btn-full btn-primary">{{ collection_name.title }}</a>
</li>
{% endfor %}
Does someone have a solution?
I’m using Jekyll 3.8.5, and due to Github Pages plugin I can’t use Jekyll 4.0 for now.
collection_names is the actual name of the collection?
What happens when you run that? nothing? are you sure you have collections setup correctly? are they outputting to where you told them to (if you have output true).
A little more info like what you have in your config and what is in the collection would be good. Link to repo even better.
No collection_name is just an example.
This works, but I have to put it in every category list pages with replacing the name of the category. The config file is good, everything set to output: true. I tried to do it like this:
{% for {{page.collection_name}} in site.{{page.collection_name}}s %}