cannot parse {{blog.content}} inside if condition


I made a blog website and I am trying to render all my posts. I have truncated my posts whose content was greater than 500 alphabets and I added a read more anchor tag.
I want that read more anchor tag to come only if my content is greater than 500 works
I wrote this line but it didn’t work:

   {% for blog in blogs %}
<div class="card-body d-flex flex-column align-items-start">

        <strong class="d-inline-block mb-2 text-success">{{}}</strong>
        <h3 class="mb-0">
            <a class="text-dark" href="/blog/{{blog.slug}}">{{blog.title}}</a>
        <div class="mb-1 text-muted">{{blog.timeStamp}}</div>
        <p class="card-text mb-auto">{{blog.content | truncatechars:500 }}</p>
        {% if len({{blog.content) >500 %}
        <a href="/blog/{{blog.slug}}">Continue reading</a>
        {% endif %}
{% endfor %}

can someone help me with what I should use in place of this code?


    {% if blog.content|length > 500 %}

Answered By – Alphonse Prakash

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published