This commit is contained in:
m
2026-03-25 01:51:21 +01:00
parent a90f06d913
commit 9a83309d36
2 changed files with 14 additions and 32 deletions

View File

@@ -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