{%- if page.categories or page.tags-%}

You might also like

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

{{ post.title }}

{% if post.author %} {{ authorName }} {% endif %} {{authorName}}
{{post.date | date_to_string }}
Read More
{% assign maxRelatedCounter = maxRelatedCounter | plus: 1 %} {% if maxRelatedCounter >= maxRelated %} {% break %} {% endif %} {% endif %} {% endfor %} {%- if page.tags -%} {%- include section/related_tag_post.html -%} {%- endif -%}