Skip to content

Instantly share code, notes, and snippets.

@landlockedboat
Last active December 28, 2019 16:32
Show Gist options
  • Save landlockedboat/68c3089f7c1e80f531d0e09a6cb7b816 to your computer and use it in GitHub Desktop.
Save landlockedboat/68c3089f7c1e80f531d0e09a6cb7b816 to your computer and use it in GitHub Desktop.
Include Jekyll posts by tag following the desired tag order
---
layout: default
---
<div class="home">
{% include posts-by-tag.html tag_name="tag2" %}
{% include posts-by-tag.html tag_name="tag1" %}
</div>
{% for tag in site.tags %}
{% capture tag_name %}{{tag | first}}{% endcapture %}
{% if tag_name == include.tag_name %}
<h2 class="post-list-heading" id="{{ tag[0] | slugify }}">{{ tag_name }}</h2>
<ul class="post-list">
{% for post in tag[1] %}
<br>
<h3>
<a class="post-link" href="{{ post.url | relative_url }}">
{{ post.title | escape }}
</a>
</h3>
<div class="post-meta">{{ post.date | date: "%b %-d, %Y" }}</div>
</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment