Skip to content

Instantly share code, notes, and snippets.

@BryanSchuetz
Last active October 13, 2016 07:18
Show Gist options
  • Save BryanSchuetz/df9d5c764c6f43366dcb to your computer and use it in GitHub Desktop.
Save BryanSchuetz/df9d5c764c6f43366dcb to your computer and use it in GitHub Desktop.
Liquid: Siteleaf Related Posts
<ul>
{% for related_post in parent.posts %}
{% for tag in current.taxonomy['tags'].values %}
{% if related_post.taxonomy['tags'][tag.slug] and related_post.id != current.id %}
<li><a href="{{related_post.url}}">{{related_post.title}}</a></li>
{% break %}
{% endif %}
{% endfor %}
{% if forloop.index == 3 %}{% break %}{% endif %}
{% endfor %}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment