load impressum from content

This commit is contained in:
Yannik Schmidt
2020-08-28 18:24:39 +02:00
parent e9040e4762
commit e78117b9cb
5 changed files with 20 additions and 2 deletions

View File

@@ -73,4 +73,7 @@ You can add new subpages in the *content*-location via a *subpages.json* file de
"identifiert-2" : "html-template-2.html"
}
# Contact Page
Templates for the contact information and legal page can be found in the example content directory. It can be edited freely and is just a suggestion.
The templates referenced here must be located in a *subpages/* directory and will be made availiable at */content?id=identifier*.

View File

@@ -39,7 +39,7 @@
</div>
<div class="row impressum mt-5"></div>
<div class="col-lg-12">
{% include 'impressum_text.html' %}
{{ text }}
</div>
</div>
</div>

View File

@@ -156,7 +156,20 @@ def root():
@app.route("/impressum")
def impressum():
return flask.render_template("impressum.html", conf=app.config)
impressumPath = os.path.join(app.config["CONTENT_DIR"], "impressum.html")
impressumTextPath = os.path.join(app.config["CONTENT_DIR"], "impressum_text.html")
impressumText = None
impressumFull = None
with open(impressumTextPath) as f:
impressumText = flask.Markup(f.read())
#impressumText = flask.Markup(impressumTextPath)
with open(impressumPath) as f:
impressumFull = flask.render_template_string(f.read(), conf=app.config, text=impressumText)
return flask.render_template("stub.html", content=impressumFull)
@app.route("/people")
def people():

2
templates/stub.html Normal file
View File

@@ -0,0 +1,2 @@
{# this is is an inclusion stub to bypass the flask limitation of only having one template directory #}
{{ content | safe }}