Blog, Website & Page Publishing

AmandaIman
Member

Related Articles

Trying to get our blog to post the related articles only by tag and instead it is showing just other articles from the blog. Does anyone know how to correct this?

 

Here's an example article: https://blog.fblake.bank/thewateringhole/checks-and-balances-balancing-your-checkbook

Note that it is showing related articles from our "Success Stories" tag instead of the "For You" tag like the original article. 

 

Here's the existing code in the template we selected:

{% macro recent_post(post, count, total) %}
{% if count == 1 %}
<section class="blog-related-posts">
<h2 class="blog-related-posts__title">{{ module.heading }}</h2>
<div class="blog-related-posts__list">
{% endif %}
<article class="related-post">
{% if post.featured_image %}
<div class="related-post__image-wrapper">
<a href="{{ post.absolute_url }}">
<img class="related-post__image" src="{{ post.featured_image }}" loading="lazy" alt="{{ post.featured_image_alt_text }}">
</a>
</div>
{% endif %}
<section class="related-post__content">
{% if post.tag_list %}
<div class="related-post__tags">
{% for tag in post.tag_list %}
<a class="related-post__tag-link" href="{{ blog_tag_url(group.id, tag.slug) }}">{{ tag.name }}</a>
{% endfor %}
</div>
{% endif %}
<h3 class="related-post__title"><a href="{{ post.absolute_url }}">{{ post.name }}</a></h3>
<div class="related-post__post-summary">{{ post.post_list_content|truncatehtml(170) }}</div>
<div class="related-post__author">
{% if post.blog_author.avatar %}
<div class="related-post__author-image-wrapper">
<img class="related-post__author-image" src="{{ post.blog_author.avatar }}" width="45" loading="eager" alt="{{ post.blog_post_author.display_name }}">
</div>
{% endif %}
<a class="related-post__author-name" href="{{ group.absolute_url }}/author/{{ post.blog_post_author.slug }}">{{ post.blog_post_author.display_name }}</a>
</div>
<a class="related-post__button button button" href="{{ post.absolute_url }}">{{ module.read_more_text }}</a>
</section>
</article>
{% if count == total %}
</div>
</section>
{% endif %}
{% endmacro %}

{% related_blog_posts limit=2, post_formatter="recent_post", no_wrapper=True %}

0 Upvotes
2 Replies 2
KOraka
Member

Related Articles

I have no knowledge about it but also thinking to add the related articles by tags I will try to apply this guide on my website to fix it right.

0 Upvotes
webdew
Guide | Diamond Partner
Guide | Diamond Partner

Related Articles

Hi @AmandaIman ,

You can use the Hubspot RSS Listing Module. with the help of this module you can fetch the blogs according to the particular tags.
https://knowledge.hubspot.com/design-manager/add-an-rss-feed-to-a-page-or-post


Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regard.

0 Upvotes