diff --git a/templates/components/post_renderer.html b/templates/components/post_renderer.html new file mode 100644 index 0000000..eb9ed22 --- /dev/null +++ b/templates/components/post_renderer.html @@ -0,0 +1,9 @@ +{% macro render_post(post) %} +
+ {% if post.template %} {% include post.template %} {% endif %} {{ post.content + | safe }} +
+ +
+ +{% endmacro %} diff --git a/templates/post_detail.html b/templates/post_detail.html index f1edf9b..df855ed 100644 --- a/templates/post_detail.html +++ b/templates/post_detail.html @@ -1,5 +1,7 @@ {% 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 %} +

{{ post.title }}

@@ -9,7 +11,7 @@ Template{% endblock %} {% block content %} Posted on {{ post.date }}


- {% if post.id == 8 %} + {{ render_post(post, post.displayall) }} {% if post.id == 8 %}

@@ -19,8 +21,6 @@ Template{% endblock %} {% block content %}
{{ post.content | safe }}
- {% if post.template} {% include post.template %} {% endif %} - ← Back to Posts