You might also like

{% assign blogData= site.data.blog.blog %} {% assign maxRelated = 6 %} {% assign minCommonTags = 1 %} {% assign maxRelatedCounter = 0 %}
{% for post in blogData %} {% assign sameTagCount = 0 %} {% assign commonTags = '' %} {%- if page.categories-%} {% for category in post.categories %} {% if post.url != page.url %} {% if page.categories contains category %} {% assign sameTagCount = sameTagCount | plus: 1 %} {% endif %} {% endif %} {% endfor %} {%- endif -%} {%- if page.tags -%} {% for tag in post.tags %} {% if post.url != page.url %} {% if page.tags contains tag %} {% assign sameTagCount = sameTagCount | plus: 1 %} {% endif %} {%- endif -%} {% endfor %} {%- endif -%} {% if sameTagCount >= minCommonTags %} {%- include authors/authors.html-%}
{{post.title}}

{{ 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 %} {%- else -%} {%- endif -%} {% endfor %} {%- assign remamingPosts = maxRelated | minus: maxRelatedCounter -%} {%- if remamingPosts > 0 -%} {% assign posts = blogData | where_exp:"post","post.url != page.url" %} {% for post in posts %} {%- if remamingPosts > 0 -%} {%- assign tagData = true -%} {%- assign catData = true -%} {%- if page.tags -%} {% for tag in post.tags %} {% if post.url != page.url %} {% if page.tags contains tag %} {%- assign tagData = false -%} {%- break -%} {% endif %} {%- endif -%} {% endfor %} {%- endif -%} {%- if page.categories-%} {%- if tagData == false -%} {%- continue -%} {%- else -%} {% for category in post.categories %} {% if post.url != page.url %} {% if page.categories contains category %} {%- assign catData = false -%} {%- break -%} {% endif %} {% endif %} {% endfor %} {%- endif -%} {%- if catData == false -%} {%- continue -%} {%- endif -%} {%- assign remamingPosts = remamingPosts | minus: 1 -%} {%- include authors/authors.html-%}
{{post.title}}

{{ post.title }}

{% if post.author %} {{ authorName }} {% endif %} {{authorName}}
{{post.date | date_to_string }}
Read More
{%- endif -%} {%- endif -%} {% endfor %} {%- endif -%}