diff --git a/content.example/mainLinks/example.json b/content.example/mainLinks/example.json new file mode 100644 index 0000000..e3bf837 --- /dev/null +++ b/content.example/mainLinks/example.json @@ -0,0 +1,5 @@ +{ + "headline" : "Headline", + "link" : "https://example.com", + "picture" :"example.png" +} diff --git a/server.py b/server.py index 5acf1a6..b52fdc9 100755 --- a/server.py +++ b/server.py @@ -13,9 +13,10 @@ from werkzeug.routing import BuildError import xml.etree.ElementTree as et # paths -SECTIONS_DIR = "sections/" -NEWS_DIR = "news/" -PICTURES_DIR = "pictures/" +SECTIONS_DIR = "sections/" +NEWS_DIR = "news/" +PICTURES_DIR = "pictures/" +MAIN_LINKS_DIR = "mainLinks/" # json config keys TIMEOUT_RELATIVE = "timeout-relative-weeks" @@ -128,6 +129,7 @@ def invalidateEventCache(): @app.route("/") def root(): return flask.render_template("index.html", conf=app.config, + mainLinks=readJsonDir(app.config["MAIN_LINKS_DIR"]), events=getEventsCache(), moreEvents=len(getEventsCache())>3, sections=readJsonDir(app.config["SECTIONS_DIR"]), @@ -242,8 +244,9 @@ def siteMap(): @app.before_first_request def init(): - app.config["SECTIONS_DIR"] = os.path.join(app.config["CONTENT_DIR"], SECTIONS_DIR) - app.config["NEWS_DIR"] = os.path.join(app.config["CONTENT_DIR"], NEWS_DIR) + app.config["SECTIONS_DIR"] = os.path.join(app.config["CONTENT_DIR"], SECTIONS_DIR) + app.config["NEWS_DIR"] = os.path.join(app.config["CONTENT_DIR"], NEWS_DIR) + app.config["MAIN_LINKS_DIR"] = os.path.join(app.config["CONTENT_DIR"], MAIN_LINKS_DIR) if app.config["RELOAD_CALENDAR_ON_START"]: updateEventsFromCalDav() diff --git a/templates/index.html b/templates/index.html index 0047b0b..58fa82c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -30,13 +30,33 @@ -