I’m getting a summary of blog posts to related blog posts.
However, when I use:
${blogpost.postSummary|striptags|safe|truncate(200)}
I get nothing. Actually, I don’t even get titles and images anymore.
If I remove filters, it breaks my layout. Funnily this same code works very nicely with
{ content.post_summary|striptags|safe|truncate(200) }
Which is not course content I want to related blog posts.
Whole code looks like this:
{% related_blog_posts limit=3, callback="blog_post_formatter" %}
<script>
var blog_post_formatter = function(blogposts) {
var formatted = '<div class="blog-listing">';
for (var i = 0; i < blogposts.length; i++) {
var blogpost = blogposts[i];
formatted += `<a href="${blogpost.url}" class="article display-flex flex-direction-column">`;
formatted += '<div class="article-image">';
if (blogpost.featuredImage) {
formatted += `<img src="${blogpost.featuredImage}" alt="${blogpost.featuredImageAltText}">`;
}
formatted += '</div>';
formatted += '<div class="article-content display-flex flex-direction-column flex-grow-1">';
formatted += `<h2>${blogpost.name}</h2>`;
formatted += `<p class="article-summary flex-grow-1">${blogpost.postSummary|striptags|safe|truncate(200)}</p>`;
formatted += `<h5>${blogpost.blogAuthor.fullName}</h5>`;
formatted += '</div></a>';
}
formatted += '</div>';
return formatted;
}
</script>
Do you have any suggestions on how to get summaries working?