Retrieve related articles based on tag Edit: changed it from only checking the first tag in the article to going through every tag. It's more resource intensive but only checking the first tag isn't good enough in most cases
{% assign counter = 0 %}
{% assign max_count = 3 %}
{% capture handle %}{{ related_articles }}{% endcapture %}
{% for related in blogs[handle].articles %}
<!-- Goes through all articles in the blog -->
{% for tag in article.tags %}
<!-- Goes through the tags in the current article -->
{% for art_tag in related.tags %}
<!-- Goes through the other article tags in the blog -->
{% if tag == art_tag and counter < max_count and related.url != article.url %}
<!--
if there is a tag in the article iteration that is the same as the first tag in the current article
&& there has been less than max_count occurrences
&& the article is not the same as the main one
-->
<div class="post">
<h2><a href="{{ related.url }}">{{ related.title }}</a></h2>
<p class="date">{{ related.created_at | date: "%d/%m/%Y" }}</p>
</div><!-- /.post -->
{% assign counter = counter | plus: 1 %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}