mirror of
https://github.com/FAUSheppy/flask-json-dream-website
synced 2025-12-06 00:01:36 +01:00
load impressum from content
This commit is contained in:
@@ -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"
|
"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*.
|
The templates referenced here must be located in a *subpages/* directory and will be made availiable at */content?id=identifier*.
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row impressum mt-5"></div>
|
<div class="row impressum mt-5"></div>
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
{% include 'impressum_text.html' %}
|
{{ text }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
15
server.py
15
server.py
@@ -156,7 +156,20 @@ def root():
|
|||||||
|
|
||||||
@app.route("/impressum")
|
@app.route("/impressum")
|
||||||
def 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")
|
@app.route("/people")
|
||||||
def people():
|
def people():
|
||||||
|
|||||||
2
templates/stub.html
Normal file
2
templates/stub.html
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
{# this is is an inclusion stub to bypass the flask limitation of only having one template directory #}
|
||||||
|
{{ content | safe }}
|
||||||
Reference in New Issue
Block a user