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

View File

@@ -1,26 +0,0 @@
{% extends "base.html" %} {% block title %}{{ post.title }} - Simple Blog
Template{% endblock %} {% block content %} {% from
"components/post_renderer.html" import render_test %} {% from
"components/comment_renderer.html" import render_comment %}
<div class="row">
<div class="col-lg-12">
<h1 class="text-3xl font-bold mb-8">{{ post.title }}</h1>
<p class="lead">{{ post.subtitle }}</p>
<p>
<span class="glyphicon glyphicon-time"></span> Posted on {{ post.date }}
</p>
{{ render_test(post) }}
<div class="post-actions">
<a href="{{ url_for('home') }}" class="btn btn-default btn-custom"
>← Back to Posts</a
>
</div>
<hr style="margin-top: 25px; margin-bottom: 10px" />
{% include 'leave_comment.html' %}
<hr />
{{render_comment(comments)}}
</div>
</div>
{% endblock %}