diff options
author | mjfernez <mjf@mjfer.net> | 2021-12-22 16:38:35 -0500 |
---|---|---|
committer | mjfernez <mjf@mjfer.net> | 2021-12-22 16:38:35 -0500 |
commit | e4b7179c121473be2e53999cc50933521498c7a9 (patch) | |
tree | 36d42bef404caca4bb91d2f70f01dd5f020d4d8e /views.py | |
parent | 5265b6ffb405f019647fd28ede8458fd6ab40dc5 (diff) | |
download | ezcms-e4b7179c121473be2e53999cc50933521498c7a9.tar.gz |
Removed "/site" appendage. CSS fixes
This commit removes the "/site" appended to every directory and solved
the problem of redirecting links correctly by setting 'parent_dir' in
the main view context to point to '/' by default.
This also changes how titles appear to conform to my sensibilities.
Diffstat (limited to 'views.py')
-rw-r--r-- | views.py | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -18,9 +18,8 @@ CONTENT_BLOCK = ( @app.route("/") -@app.route("/site") -@app.route("/site/home.html") -@app.route("/site/index.html") +@app.route("/home.html") +@app.route("/index.html") @cache.cached() def home(): """ @@ -31,13 +30,13 @@ def home(): """ context = default_context() context.update( - {'title': app.config['HOME_TITLE'], 'parent_dir': '/site/'} + {'title': app.config['HOME_TITLE'], 'parent_dir': None} ) return render_template("site/home.html", **context) # from: https://pythonise.com/series/learning-flask/sending-files-with-flask -@app.route("/site/<path:path>") +@app.route("/<path:path>") @cache.cached() def render_file(path): """ @@ -55,7 +54,7 @@ def render_file(path): context.update( { 'title': path.split('.')[0].upper(), - 'parent_dir': '/site/' + '/'.join(path.split('/')[:-1]), + 'parent_dir': '/' + '/'.join(path.split('/')[:-1]), 'last_update': file_last_modified(abs_path), } ) @@ -82,7 +81,7 @@ def render_file(path): dirs, files, links, description = index_dir(abs_path) context.update( { - 'cur_path': 'site/' + path, + 'cur_path': path, 'cur_dir': path.split('/')[-1] + '/', 'dirs': dirs, 'files': files, |