Auto truncate long blog posts in archive view
authorKostas Papadimitriou <kpap@grnet.gr>
Thu, 22 Mar 2012 08:48:14 +0000 (10:48 +0200)
committerKostas Papadimitriou <kpap@grnet.gr>
Thu, 22 Mar 2012 08:48:14 +0000 (10:48 +0200)
cloudcmsblog/templates/cloudcmsblog/archive.html

index 9a5d064..7324da2 100644 (file)
         {% endif %}
         {% if entry.intro_text %}
         <div class="intro-content">
-            {{ entry.intro_text|safe }}
+            {{ entry.intro_text|safe|truncatewords:100 }}
+            {% if entry.intro_text|safe|wordcount > 100 %}
+                <a href="{{ entry.get_absolute_url }}">{% trans "read more" %}</a>
+            {% endif %}
         </div>
         {% endif %}
         <div class="entry-info">