_includes/customblog/relatedposts.html in appscms-tools-theme-1.9.1 vs _includes/customblog/relatedposts.html in appscms-tools-theme-1.9.2
- old
+ new
@@ -1,11 +1,19 @@
<section class="related-posts-section">
<div class="container">
+
<div class="relatedPosts">
+ {%- if site.monumetricId -%}
+ <div class="row">
+ <div class="col-md-9 mx-auto">
+ {%- endif -%}
+ <h2 class="pt-5 pb-0 related_post_heading mb-3">You might also like</h2>
+ {%- if site.monumetricId -%}
+ </div>
+ </div>
+ {%- endif -%}
- <h2 class="pt-5 pb-0 related_post_heading">You might also like</h2>
-
{% assign blogData= site.data.blog.blog %}
{% assign maxRelated = 6 %}
{% assign minCommonTags = 1 %}
@@ -22,154 +30,184 @@
{% assign tags= site.data[folder][lang][file].tags %}
{%- else -%}
{% assign tags= page.tags %}
{%- endif -%}
<div class="row">
- {% for post in blogData %}
- {% assign sameTagCount = 0 %}
- {% assign commonTags = '' %}
+ {%- if site.monumetricId -%}
+ <div class="col-md-9 mx-auto">
+ <div class="row">
+ {%- endif -%}
- {%- if categories-%}
- {% for category in post.categories %}
- {% if post.url != page.url %}
- {% if categories contains category %}
- {% assign sameTagCount = sameTagCount | plus: 1 %}
- {% endif %}
- {% endif %}
- {% endfor %}
- {%- endif -%}
+ {% for post in blogData %}
+ {% assign sameTagCount = 0 %}
+ {% assign commonTags = '' %}
- {%- if tags -%}
- {% for tag in post.tags %}
- {% if post.url != page.url %}
- {% if tags contains tag %}
- {% assign sameTagCount = sameTagCount | plus: 1 %}
- {% endif %}
- {%- endif -%}
- {% endfor %}
- {%- endif -%}
+ {%- if categories-%}
+ {% for category in post.categories %}
+ {% if post.url != page.url %}
+ {% if categories contains category %}
+ {% assign sameTagCount = sameTagCount | plus: 1 %}
+ {% endif %}
+ {% endif %}
+ {% endfor %}
+ {%- endif -%}
- {% if sameTagCount >= minCommonTags %}
- {%- include authors/authors.html-%}
- <div class="col-lg-4 col-md-6 mb-4 card-group">
- <div class="card h-100">
- <a href="{{ post.url }}">
- <img src="{{ post.image }}" loading="lazy" class="card-img-top" height="auto" width="100%"
- alt="{{post.title}}" {%- if site.crossorigin -%} crossorigin {%- endif -%}>
- </a>
- <div class="card-body">
- <a class="text-decoration-none text-dark" href="{{ post.url }}" class="anchor_link">
- <h4 class="card-title mb-4 text-left">{{ post.title }}</h4>
- </a>
- </div>
- <div class="card-footer bg-white">
- <div class="wrapfooter">
- {% if post.author %}
- <span class="meta-footer-thumb">
- <img class="author-thumb" loading="lazy" src="{{ image }}" alt="{{ authorName }}"
- {%- if site.crossorigin -%} crossorigin {%- endif -%}>
- </span>
- {% endif %}
+ {%- if tags -%}
+ {% for tag in post.tags %}
+ {% if post.url != page.url %}
+ {% if tags contains tag %}
+ {% assign sameTagCount = sameTagCount | plus: 1 %}
+ {% endif %}
+ {%- endif -%}
+ {% endfor %}
+ {%- endif -%}
- <span class="author-meta">
- <span class="post-name">
- <a target="_blank" href="/blog">{{authorName}}</a>
- </span><br>
- <span class="post-date">{{post.date | date_to_string }}</span>
- </span>
- <span class="post-read-more"><a class="text-dark" href="{{ post.url }}"
- title="Read Story">Read
- More</a></span>
+
+ {% if sameTagCount >= minCommonTags %}
+ {%- include authors/authors.html-%}
+ <div class="
+ {%- if site.monumetricId -%}
+ col-md-6 mb-4 card-group
+ {%- else -%}
+ col-lg-4 col-md-6 mb-4 card-group
+ {%- endif -%}
+
+ ">
+ <div class="card h-100">
+ <a href="{{ post.url }}">
+ <img src="{{ post.image }}" loading="lazy" class="card-img-top" height="auto"
+ width="100%" alt="{{post.title}}" {%- if site.crossorigin -%} crossorigin {%-
+ endif -%}>
+ </a>
+ <div class="card-body">
+ <a class="text-decoration-none text-dark" href="{{ post.url }}" class="anchor_link">
+ <h4 class="card-title mb-4 text-left">{{ post.title }}</h4>
+ </a>
+ </div>
+ <div class="card-footer bg-white">
+ <div class="wrapfooter">
+ {% if post.author %}
+ <span class="meta-footer-thumb">
+ <img class="author-thumb" loading="lazy" src="{{ image }}"
+ alt="{{ authorName }}" {%- if site.crossorigin -%} crossorigin {%- endif
+ -%}>
+ </span>
+ {% endif %}
+
+ <span class="author-meta">
+ <span class="post-name">
+ <a target="_blank" href="/blog">{{authorName}}</a>
+ </span><br>
+ <span class="post-date">{{post.date | date_to_string }}</span>
+ </span>
+ <span class="post-read-more"><a class="text-dark" href="{{ post.url }}"
+ title="Read Story">Read
+ More</a></span>
+ </div>
+ </div>
</div>
</div>
- </div>
- </div>
- {% assign maxRelatedCounter = maxRelatedCounter | plus: 1 %}
- {% if maxRelatedCounter >= maxRelated %}
- {% break %}
- {% endif %}
- {%- else -%}
- {%- endif -%}
- {% endfor %}
- {%- assign remamingPosts = maxRelated | minus: maxRelatedCounter -%}
+ {% 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 tags -%}
- {% for tag in post.tags %}
- {% if post.url != page.url %}
- {% if tags contains tag %}
- {%- assign tagData = false -%}
- {%- break -%}
- {% endif %}
- {%- endif -%}
- {% endfor %}
- {%- endif -%}
- {%- if categories-%}
- {%- if tagData == false -%}
- {%- continue -%}
+ {%- 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 tags -%}
+ {% for tag in post.tags %}
+ {% if post.url != page.url %}
+ {% if tags contains tag %}
+ {%- assign tagData = false -%}
+ {%- break -%}
+ {% endif %}
+ {%- endif -%}
+ {% endfor %}
+ {%- endif -%}
+ {%- if categories-%}
+ {%- if tagData == false -%}
+ {%- continue -%}
+ {%- else -%}
+ {% for category in post.categories %}
+ {% if post.url != page.url %}
+ {% if 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-%}
+ <div class="
+ {%- if site.monumetricId -%}
+ col-md-6 mb-4 card-group
{%- else -%}
- {% for category in post.categories %}
- {% if post.url != page.url %}
- {% if 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-%}
- <div class="col-lg-4 col-md-6 mb-4 card-group">
- <div class="card h-100">
- <a href="{{ post.url }}">
- <img src="{{ post.image }}" class="card-img-top" height="215px" width="100%" loading="lazy"
- alt="{{post.title}}" {%- if site.crossorigin -%} crossorigin {%- endif -%}>
- </a>
- <div class="card-body">
- <a class="text-decoration-none text-dark" href="{{ post.url }}" class="anchor_link">
- <h4 class="card-title mb-4 text-left">{{ post.title }}</h4>
- </a>
- </div>
- <div class="card-footer bg-white">
- <div class="wrapfooter">
- {% if post.author %}
- <span class="meta-footer-thumb">
- <img class="author-thumb" loading="lazy" src="{{image}}" alt="{{ authorName }}" {%-
- if site.crossorigin -%} crossorigin {%- endif -%}>
- </span>
- {% endif %}
- <span class="author-meta">
- <span class="post-name">
- <a target="_blank" href="/blog">{{authorName}}</a>
- </span><br>
- <span class="post-date">{{post.date | date_to_string }}</span>
- </span>
- <span class="post-read-more"><a class="text-dark" href="{{ post.url }}"
- title="Read Story">Read
- More</a></span>
+ col-lg-4 col-md-6 mb-4 card-group
+ {%- endif -%}
+
+
+ ">
+ <div class="card h-100">
+ <a href="{{ post.url }}">
+ <img src="{{ post.image }}" class="card-img-top" height="215px" width="100%"
+ loading="lazy" alt="{{post.title}}" {%- if site.crossorigin -%} crossorigin {%-
+ endif -%}>
+ </a>
+ <div class="card-body">
+ <a class="text-decoration-none text-dark" href="{{ post.url }}" class="anchor_link">
+ <h4 class="card-title mb-4 text-left">{{ post.title }}</h4>
+ </a>
+ </div>
+ <div class="card-footer bg-white">
+ <div class="wrapfooter">
+ {% if post.author %}
+ <span class="meta-footer-thumb">
+ <img class="author-thumb" loading="lazy" src="{{image}}"
+ alt="{{ authorName }}" {%- if site.crossorigin -%} crossorigin {%- endif
+ -%}>
+ </span>
+ {% endif %}
+ <span class="author-meta">
+ <span class="post-name">
+ <a target="_blank" href="/blog">{{authorName}}</a>
+ </span><br>
+ <span class="post-date">{{post.date | date_to_string }}</span>
+ </span>
+ <span class="post-read-more"><a class="text-dark" href="{{ post.url }}"
+ title="Read Story">Read
+ More</a></span>
+ </div>
+ </div>
</div>
</div>
+ {%- endif -%}
+ {%- endif -%}
+
+ {% endfor %}
+ {%- endif -%}
+
+ {%- if site.monumetricId -%}
+
</div>
</div>
{%- endif -%}
- {%- endif -%}
-
- {% endfor %}
- {%- endif -%}
-
</div>
</div>
</div>
</section>
\ No newline at end of file