inject css

This commit is contained in:
m
2026-03-25 05:03:29 +01:00
parent 9a83309d36
commit 20fce270a5
5 changed files with 39 additions and 28 deletions

22
app.py
View File

@@ -106,20 +106,32 @@ def about():
return render_template('about.html', about_txt = about_txt, blog_title = TITLE)
@app.route('/post/<int:post_id>')
def post_detail(post_id):
# One call to get the data + the extra logic (templates/timelines)
context = {"used_components": set()}
post = get_enriched_post(post_id, BLOG_POSTS)
if not post:
return "Post not found", 404
comments = get_comments_for_post(post_id)
return render_template('post_detail.html', post=post, comments=comments, blog_title = TITLE)
context["used_components"].add("image")
#processed_content = render_content(post['content'], context=context)
css_files = []
for comp in context["used_components"]:
css_files.append(f"css/components/{comp}.css")
return render_template(
"post_detail.html",
post=post,
comments=comments,
blog_title = TITLE,
component_css=css_files
)
@app.route('/content/image/<path:filename>')