diff --git a/app.py b/app.py index fbd882c..3beb7f2 100644 --- a/app.py +++ b/app.py @@ -116,6 +116,10 @@ def post_detail(post_id): return "Post not found", 404 #get comments comments = get_comments_for_post(post_id) + if post.id == 10: + + post.template = "components/timeline_post.html" + # 2. Pass the post dictionary (with the raw HTML content) directly to the template return render_template('post_detail.html', post=post, comments=comments, blog_title = TITLE) diff --git a/templates/components/post_renderer.html b/templates/components/post_renderer.html index eb9ed22..83f8387 100644 --- a/templates/components/post_renderer.html +++ b/templates/components/post_renderer.html @@ -1,7 +1,7 @@ {% macro render_post(post) %}
- {% if post.template %} {% include post.template %} {% endif %} {{ post.content - | safe }} + {{ post.content | safe }}{% if post.template %} {% include post.template %} {% + endif %}

diff --git a/templates/components/timeline_post.html b/templates/components/timeline_post.html new file mode 100644 index 0000000..0916315 --- /dev/null +++ b/templates/components/timeline_post.html @@ -0,0 +1 @@ +{% include "components/timeline.html" %}