image template
This commit is contained in:
10
app.py
10
app.py
@@ -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 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
|
||||
|
||||
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)
|
||||
|
||||
|
||||
|
||||
|
||||
@app.route('/content/image/<path:filename>')
|
||||
def content_image_files(filename):
|
||||
return send_from_directory('content/image', filename)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
2
content
2
content
Submodule content updated: 93b20a38f8...5dcd5bdcee
@@ -1,3 +1,12 @@
|
||||
{% macro render_post(post) %}
|
||||
<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 %}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<h1 class="text-3xl font-bold mb-8">Project Timeline</h1>
|
||||
|
||||
{% include "components/timeline.html" %}
|
||||
Reference in New Issue
Block a user