inject css
This commit is contained in:
22
app.py
22
app.py
@@ -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>')
|
||||
|
||||
Reference in New Issue
Block a user