post renderer

This commit is contained in:
m
2026-03-14 12:36:13 +01:00
parent 4e1b11685f
commit 345a0d942f
2 changed files with 13 additions and 4 deletions

View File

@@ -0,0 +1,9 @@
{% macro render_post(post) %}
<article class="blog-content">
{% if post.template %} {% include post.template %} {% endif %} {{ post.content
| safe }}
</article>
<hr class="post-divider post-divider-expanded" />
{% endmacro %}

View File

@@ -1,5 +1,7 @@
{% extends "base.html" %} {% block title %}{{ post.title }} - Simple Blog {% extends "base.html" %} {% block title %}{{ post.title }} - Simple Blog
Template{% endblock %} {% block content %} Template{% endblock %} {% block content %} {% from
"components/post_renderer.html" import render_post %}
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<h1 class="post-title">{{ post.title }}</h1> <h1 class="post-title">{{ post.title }}</h1>
@@ -9,7 +11,7 @@ Template{% endblock %} {% block content %}
<span class="glyphicon glyphicon-time"></span> Posted on {{ post.date }} <span class="glyphicon glyphicon-time"></span> Posted on {{ post.date }}
</p> </p>
<hr /> <hr />
{% if post.id == 8 %} {{ render_post(post, post.displayall) }} {% if post.id == 8 %}
<div class="background-svg"> <div class="background-svg">
<img src="{{ url_for('static', filename='animation.svg') }}" alt="" /> <img src="{{ url_for('static', filename='animation.svg') }}" alt="" />
<br /> <br />
@@ -19,8 +21,6 @@ Template{% endblock %} {% block content %}
<div class="blog-content">{{ post.content | safe }}</div> <div class="blog-content">{{ post.content | safe }}</div>
{% if post.template} {% include post.template %} {% endif %}
<a href="{{ url_for('home') }}" class="btn btn-default btn-custom" <a href="{{ url_for('home') }}" class="btn btn-default btn-custom"
>← Back to Posts</a >← Back to Posts</a
> >