CMS Development

Marius
Teilnehmer/-in | Platinum Partner
Teilnehmer/-in | Platinum Partner

Some Post List Content show blank in listing page

There're some posts that show blank content in the blog list page. Those posts got content like any other post in my blog. Here's my code for listing page:

 

{% for content in contents %}
<div class="post-item b4y-post-item">
{% if not simple_list_page %}


<img src="{{ content.post_list_summary_featured_image }}" alt="{{ content.featured_image_alt_text }}" class="blog-list-img">

<div class="post-body clearfix post-body-list">

{% if content.topic_list %}
<p id="hubspot-topic_data">
{% for topic in content.topic_list %}
<a class="topic-link" href="{{ group.absolute_url }}/topic/{{ topic.slug }}">{{ topic.name }}</a>{% if not loop.last %},{% endif %}
{% endfor %}
</p>
{% endif %}

<div class="post-header">
<h2>{{ content.name }}</h2>
</div>
<div class="post-list-item-content">
{{ content.post_list_content|truncatehtml(120, '...', false)}}
</div>

</div>
{% if content_group.show_summary_in_listing %}
<a class="more-link" href="{{ content.absolute_url }}">Mehr lesen</a>
{% endif %}
{% else %}
<h2 class="post-listing-simple"><a href="{{content.absolute_url}}">{{ content.name }}</a></h2>
{% endif %}
</div>
{% endfor %}

 

0 Upvotes
4 Antworten
TeamStickyleaf
Mitglied

Some Post List Content show blank in listing page

I had the same issue. For me it ended up being caused by the text appearing after the "more..." widget. When I put the opening paragraph body (in the article), befor this widget it fixed the text rendering issue for the problem article.

0 Upvotes
JagadishINB
Mitglied | Platinum Partner
Mitglied | Platinum Partner

Some Post List Content show blank in listing page

Hi @Marius,

 

Please try this below line of code replacing your line of code marked in red.

{{ content.post_summary|striptags|truncate(120,true,'...') }}

0 Upvotes
mayankk
Teilnehmer/-in

Some Post List Content show blank in listing page

I am trying to fetch recent posts from blog. It is working fine but for some posts description is coming blank. I have tried both post_list_content and summary but none of this working.

 

<!-- blog content code  sample-->

<p> {{ rec_post.post_list_content|striptags|truncate(185, breakword=False, end='...')}}<a href="{{ rec_post.url }}">Read More <i class="fa fa-caret-right "></i></a></p></span>

{{ rec_post.post_summary|striptags|truncate(120,true,'...') }} 

<!-- end -->

 

 

{% choice "number_of_posts" label='Choose the number of posts', value='3' choices='1, 2, 3', export_to_template_context=True %}
{% text "blog_id" label="Blog ID", value="BLOGID", export_to_template_context=True %}
{% set rec_posts = blog_recent_posts(widget_data.blog_id.value, widget_data.number_of_posts.value ) %}
{% for rec_post in rec_posts %}



 <img class="hs-image-widget custom-blog" src="{{ rec_post.featured_image }}" style="width:768px;border-width:0px;border:0px;min-height:199px;" alt="{{ rec_post.featured_image_alt_text }}" />





{{ rec_post.blog_post_author }} |&nbsp;

{{ datetimeformat(rec_post.publish_date_local_time, '%B %e, %Y') }} 
 {{ rec_post.post_list_content|striptags|truncate(185, breakword=False, end='...')}}<a href="{{ rec_post.url }}">Read More <i class="fa fa-caret-right "></i></a>

<!--{{ rec_post.post_summary|striptags|truncate(120,true,'...') }} -->


{% endfor %}

 

 

0 Upvotes
JagadishINB
Mitglied | Platinum Partner
Mitglied | Platinum Partner

Some Post List Content show blank in listing page

Try this, it always workd for us, you need to change Blog ID and number of feed you want to display at first line

 

{% set rec_posts = blog_recent_posts('Your Blog ID', 10) %} 
<div class="feedreader_box1"> 
{% for rec_post in rec_posts %} 
<div class="thank-u-page-rss"> 
<div class="single-blogs">    
<div class="featured-image" >  
<a href="{{rec_post.absolute_url}}" title=""> 
 <img src="{{ rec_post.featured_image }}" class="featured-image" alt="{{ rec_post.featured_image_alt_text | escape }}">
   </a> 
</div> 
<div class="black-wrapper"> 
<div class="post-name"> 
<a class="name" href="{{ rec_post.absolute_url }}">{{ rec_post.name }}</a> 
</div> 
<div class="post-cont"> 
<p>{{ rec_post.post_body|striptags|truncate(140) }}</p> 
</div> 

 <div class=“author”>
<a class="author-link" href="{{ blog_author_url(group.id, rec_post.blog_post_author.slug) }}">{{ rec_post.blog_post_author.display_name }}</a> on {{ rec_post.publish_date_localized }}
</div>
<div class="read-more-link"> 
<a class="read-more" href="{{ rec_post.absolute_url }}">Read More</a> 
</div> 
</div> 
</div> 
</div> 
{% endfor %} 
</div> 

0 Upvotes