{%- include /authors/authors.html -%} {% assign maxRelated = 1 %} {% assign minCommonTags = 1 %} {% assign maxRelatedCounter = 0 %} {% for post in site.posts %} {%- include /authors/authors.html -%} {% assign sameTagCount = 0 %} {% assign commonTags = '' %} {% for tag in post.tags %} {% if post.url != page.url %} {% if page.tags contains tag %} {% assign sameTagCount = sameTagCount | plus: 1 %} {% capture tagmarkup %} {{ tag }} {% endcapture %} {% assign commonTags = commonTags | append: tagmarkup %} {% endif %} {%- endif -%} {% endfor %} {% if sameTagCount >= minCommonTags %}
{% assign maxRelatedCounter = maxRelatedCounter | plus: 1 %} {% if maxRelatedCounter >= maxRelated %} {% break %} {% endif %} {% endif %} {% endfor %}