preview
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
{% macro render_post(post, expanded=False) %} {% if expanded %}
|
||||
|
||||
<div class="blog-content">{{ post.content | safe }}</div>
|
||||
|
||||
{% macro render_post(post, expanded=False) %} {% if expanded %} {% set ns =
|
||||
namespace(found=false, preview='') %} {% if post.content is iterable and
|
||||
post.content is not string %} {% for block in post.content %} {% if block.type
|
||||
== "text" and not ns.found %} {% set ns.preview = block.value | safe%} {% set
|
||||
ns.found = true %} {% endif %} {% endfor %} {% set preview = ns.preview %} {%
|
||||
else %} {% set preview = post.content | safe%} {% endif %}
|
||||
<div class="blog-content">{{ preview }}</div>
|
||||
<hr class="post-divider post-divider-expanded" />
|
||||
|
||||
{% else %}
|
||||
{% else %} {% set ns = namespace(found=false, preview='') %} {% if post.content
|
||||
is iterable and post.content is not string %} {% for block in post.content %} {%
|
||||
if block.type == "text" and not ns.found %} {% set ns.preview = block.value |
|
||||
striptags | truncate(200) %} {% set ns.found = true %} {% endif %} {% endfor %}
|
||||
{% set preview = ns.preview %} {% else %} {% set preview = post.content |
|
||||
striptags | truncate(200) %} {% endif %}
|
||||
|
||||
<div class="blog-preview">{{ post.content | striptags | truncate(200) }}</div>
|
||||
<div class="blog-preview">{{ preview }}</div>
|
||||
|
||||
<a class="btn-read-more" href="{{ url_for('post_detail', post_id=post.id) }}">
|
||||
Read More
|
||||
|
||||
Reference in New Issue
Block a user