How do I get translated content for related posts?
SOLVE
I have a related post module but I'm unable to get the translated posts for the 3 posts that its showing. I have a translated blog setup, posts are translated but it always pulls through the english version. I thought using the blog field would allow you to select the dutch version of the blog but that doesn't work.
<section class="blog-feed block-padding--142">
<div class="wrap">
<div class="heading-centered d-flex justify-content-center text-center">
{% if module.title %}
<h2>{{ module.title }}</h2>
{% endif %}
</div>
<div class="blog-feed_grid d-flex justify-content-between">
{% set blog_id = module.blog %}
{% set posts = blog_recent_posts('{{ module.blog }}', 3) %}
{% for post in posts %}
<a href="{{ post.absolute_url }}" class="card blog-single">
{% if post.featured_image %}
<div style="background-image:url('{{ post.featured_image }}'); background-size: cover;
height: 184px;
background-repeat: no-repeat;
background-position: top center;"
loading="lazy">
</div>
{% endif %}
<div class="card-body d-flex flex-column align-items-start">
{% for topic in post.topic_list|first %}
<span class="tag">{{topic.name}}</span>
{% endfor %}
<h3>{{ post.name }}</h3>
<!--<p>{{ post.post_list_content|safe|striptags|truncate(60, False, '…') }}</p>-->
<p>{{ post.meta_description|safe|striptags|truncate(60, False, '…') }}</p>
{% set initialPostWords = post.post_body|striptags|wordcount %}
{% set calculatedPostWords = (initialPostWords/100) * 100 %}
{% set finishedPostWords = calculatedPostWords|divide(300)|round(2) %}
{% set number = finishedPostWords|round %}
{% if number < 1 %}
{% else %}
<div class="d-flex align-items-center read-time">
<img src="https://f.hubspotusercontent40.net/hubfs/8149498/clock.svg" loading="lazy" width="18" height="18" alt="clock"/>
{{ finishedPostWords|round }} min read
</div>
{% endif %}
<button class="no-style cta pointer">Read the full story</button>
</div>
</a>
{% endfor %}
</div>
</div>
</section>
How do I get translated content for related posts?
SOLVE
Hi @ScottD22, I saw that you posted this as a standalone question so I'm just going to copy my answer from the other thread in case anyone is searching for this specific thing.
{% set blog_id = module.blog_field %}
{% set posts = blog_recent_posts(blog_id, 3) %}
{% for post in posts %}
{{post}}
//... rest of your code
{% endfor %}
How do I get translated content for related posts?
SOLVE
Hi @ScottD22, I saw that you posted this as a standalone question so I'm just going to copy my answer from the other thread in case anyone is searching for this specific thing.
{% set blog_id = module.blog_field %}
{% set posts = blog_recent_posts(blog_id, 3) %}
{% for post in posts %}
{{post}}
//... rest of your code
{% endfor %}