Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aamnah/dceb067c8bf79d017f1a16523b2c3a75 to your computer and use it in GitHub Desktop.
Save aamnah/dceb067c8bf79d017f1a16523b2c3a75 to your computer and use it in GitHub Desktop.
Loop through Jekyll collections and list their posts
{% comment %}
Loops though every collection you defined in _config.yml and grabs the pages they contain; outputting titles.
{% endcomment %}
{% for collection in site.collections %}
{% assign name = collection.label %}
<h1>{{ name }}</h1>
{% for post in site.[name] %}
<ul>
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
</ul>
{% endfor %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment