Skip to content

Instantly share code, notes, and snippets.

@42jerrykim
Created April 6, 2021 10:52
Show Gist options
  • Save 42jerrykim/3ff61cafb5a9b285bef00fc12092b21f to your computer and use it in GitHub Desktop.
Save 42jerrykim/3ff61cafb5a9b285bef00fc12092b21f to your computer and use it in GitHub Desktop.
---
layout: archive
title: "Posts by Collection"
permalink: /collections/
author_profile: true
---
{% for collection in site.collections %}
{% unless collection.output == false %}
{% if collection.label == "posts" %}
<h2><a href="/posts">Posts not in the collection</a></h2>
{% else %}
<h2>Posts of <a href="{{ collection.label }}">{{ collection.Title }}</a></h2>
{% endif %}
<ul>
{% for item in collection.docs %}
<a href="{{ item.url | relative_url }}" rel="permalink" style="white-space:nowrap; ">{{ item.title }}</a>&nbsp&nbsp|&nbsp
{% endfor %}
</ul>
{% endunless %}
{% endfor %}
{% capture written_label %}'None'{% endcapture %}
{% for collection in site.collections %}
{% unless collection.output == false or collection.label == "posts" %}
{% capture label %}{{ collection.Title }}{% endcapture %}
{% if label != written_label %}
</br></br></br>
<h1 id="{{ label | slugify }}"><a href="{{ collection.label }}"># {{ label }}</a></h1>
{% capture written_label %}{{ label }}{% endcapture %}
{% endif %}
{% endunless %}
{% for post in collection.docs %}
{% unless collection.output == false or collection.label == "posts" %}
{% include archive-single.html %}
{% endunless %}
{% endfor %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment