image template

This commit is contained in:
m
2026-03-24 21:27:59 +01:00
parent 80c66c1802
commit 664900cbd1
4 changed files with 20 additions and 6 deletions

10
app.py
View File

@@ -1,4 +1,4 @@
from flask import Flask, render_template, request, redirect, url_for from flask import Flask, render_template, request, redirect, url_for, send_from_directory
from content.posts import BLOG_POSTS from content.posts import BLOG_POSTS
from flask_logic.logic import get_enriched_post, get_comments_for_post, save_comment from flask_logic.logic import get_enriched_post, get_comments_for_post, save_comment
@@ -117,8 +117,16 @@ def post_detail(post_id):
return "Post not found", 404 return "Post not found", 404
comments = get_comments_for_post(post_id) comments = get_comments_for_post(post_id)
if post_id == 2:
return render_template('post_detail_test.html', post=post, comments=comments, blog_title = TITLE)
return render_template('post_detail.html', post=post, comments=comments, blog_title = TITLE) return render_template('post_detail.html', post=post, comments=comments, blog_title = TITLE)
@app.route('/content/image/<path:filename>')
def content_image_files(filename):
return send_from_directory('content/image', filename)
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True) app.run(debug=True)

Submodule content updated: 93b20a38f8...5dcd5bdcee

View File

@@ -1,3 +1,12 @@
{% macro render_post(post) %} {% macro render_post(post) %}
<article class="blog-content">{{ post.content | safe }}</article> <article class="blog-content">{{ post.content | safe }}</article>
{% if post.template %} {% include post.template %} {% endif %} {% endmacro %} {% if post.template %} {% include post.template %} {% endif %} {% endmacro %} {%
macro render_test(post) %}
<article class="blog-content">
{% for block in post.content %} {% if block.type == "image" %} {% include
"components/image.html" with src=url_for('content_image_files',
filename=block.src) %} {% elif block.type == "text" %}
<p>{{ block.value }}</p>
{% endif %} {% endfor %}
</article>
{% endmacro %}

View File

@@ -1,3 +0,0 @@
<h1 class="text-3xl font-bold mb-8">Project Timeline</h1>
{% include "components/timeline.html" %}