Skip to content

Instantly share code, notes, and snippets.

@sskylar
Created June 9, 2014 16:57
Show Gist options
  • Save sskylar/ec189a3ba310b1507a1e to your computer and use it in GitHub Desktop.
Save sskylar/ec189a3ba310b1507a1e to your computer and use it in GitHub Desktop.
Group posts by tag and sort alphabetically in Siteleaf
{% for tag in taxonomy['tags'] %}
<h1>{{tag}}</h1>
<ul>
{% assign sorted_posts = tag.posts.all | sort:'title' %}
{% for post in sorted_posts %}
<li>{{post.title}}</li>
{% endfor %}
</ul>
{% endfor %}
@sskylar
Copy link
Author

sskylar commented Jun 9, 2014

Note: Change taxonomy['tags'] to site.pages['blog'].taxonomy['tags'] for tags outside of current page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment