diff --git a/README.md b/README.md index cf0f7f2..b306fc2 100644 --- a/README.md +++ b/README.md @@ -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*. diff --git a/templates/impressum.html b/content.example/impressum.html similarity index 96% rename from templates/impressum.html rename to content.example/impressum.html index e3b909c..b44401b 100644 --- a/templates/impressum.html +++ b/content.example/impressum.html @@ -39,7 +39,7 @@
- {% include 'impressum_text.html' %} + {{ text }}
diff --git a/templates/impressum_text.html b/content.example/impressum_text.html similarity index 100% rename from templates/impressum_text.html rename to content.example/impressum_text.html diff --git a/server.py b/server.py index 846d62b..ac8fce2 100755 --- a/server.py +++ b/server.py @@ -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(): diff --git a/templates/stub.html b/templates/stub.html new file mode 100644 index 0000000..da46145 --- /dev/null +++ b/templates/stub.html @@ -0,0 +1,2 @@ +{# this is is an inclusion stub to bypass the flask limitation of only having one template directory #} +{{ content | safe }}