CMS Development

Janelle
Participante

Related Post with wrong description text

For some reason I can't figure out, the related article text is being taken from the current post rather than the related articles. 

See: blog.crobox.com (bottom of the article where the related articles are listed)

 

Upon reaching out, I was told this line was causing the issue:

<p>{{ content.post_list_content|striptags|truncate(200)|safe }}</p>

How do I adjust this code to use the correct featured article text?

 

Here is the full related post code:

{% if content.topic_list %}
<div class="related-posts">
	<div class="related-title"><h3>Related Articles</h3></div>
	<div class="related-post-items clearfix">
	{% set max_posts = 2 %}{#<!-- Set the max number of related posts to be output to the page here -->#}
	{% set post_list = [] %}
	{% for topic in content.topic_list %}
		{% set post_list = post_list + blog_recent_topic_posts('default', topic.slug, max_posts + 1 ) %}
		{% if loop.last %}
			{% set post_list = post_list|sort(true, false, 'publish_date')|unique('name') %}
			{% set i = 0 %}
			{% for post in post_list %}
				{% if content.absolute_url != post.absolute_url and i < max_posts %}
				
				<div class="related-post-item">
				    <a href="{{post.absolute_url}}">
				    	<div class="related-image" style="background-image:url('{{ post.featured_image }}')"></div>
				    	<div class="related-content">
				    	    	<div class="related-date">{{ post.publish_date_local_time.strftime('%b %d, %Y') }}</div>
				    	    	<div class="related-title">{{ post.name}}</div>
				    	    	<p>{{ content.post_list_content|striptags|truncate(200)|safe }}</p>
				    	</div>
				    </a>
0 Me gusta
2 Respuestas 2
roisinkirby
Equipo de producto de HubSpot
Equipo de producto de HubSpot

Related Post with wrong description text

Hey @Janelle are you still having trouble? If so please let me know and I'll get you connected with a design expert. 

0 Me gusta
Janelle
Participante

Related Post with wrong description text

I sorted it out! Just wasn't sure how to close this post.

0 Me gusta