From e4b7179c121473be2e53999cc50933521498c7a9 Mon Sep 17 00:00:00 2001 From: mjfernez Date: Wed, 22 Dec 2021 16:38:35 -0500 Subject: 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. --- mimetypes.csv | 2 +- siteconfig.py | 4 ++-- static/main.css | 11 +++++++---- templates/base.html | 9 +++++---- templates/index.html | 2 +- views.py | 13 ++++++------- 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/mimetypes.csv b/mimetypes.csv index 7e867ea..4defb37 100644 --- a/mimetypes.csv +++ b/mimetypes.csv @@ -90,4 +90,4 @@ .R,text/plain .yml,text/plain .yaml,text/plain -.md,text/markdown +.md,text/plain diff --git a/siteconfig.py b/siteconfig.py index 8717a82..aa03597 100644 --- a/siteconfig.py +++ b/siteconfig.py @@ -25,7 +25,7 @@ class siteconfig(config): MAIN_SITE_DIRS = sorted( config.DEFAULT_SITE_DIRS ) # ["dir1", "dir2", "dir3"] - + MAIN_SITE_DIRS.remove("files") # Set a custom secret key. If not set, it will be generated # Most of the time, you don't need to set this! SECRET_KEY = config.GENERATED_SECRET_KEY # replace with random number. @@ -66,7 +66,7 @@ class siteconfig(config): # RSS Settings rss_channel_config = { 'TITLE': "mjfer.net RSS Feed", - 'LINK': "https://mjfer.net/", + 'LINK': "https://mjfer.net/feed.xml", 'DESCRIPTION': "feed organized by the latest updated files", 'LANGUAGE': "en-us", 'PUBDATE': "", diff --git a/static/main.css b/static/main.css index eeaeffc..08ca707 100644 --- a/static/main.css +++ b/static/main.css @@ -1,13 +1,16 @@ -h1,h2 { +h1 { text-align: center; margin: 1% auto; white-space: normal; } -h3,h4 { - text-align: justify; +h2,h3,h4 { + text-align: left; margin: 1% auto; white-space: normal; } +h2.center { + text-align: center; +} h3.center { text-align: center; } @@ -17,7 +20,7 @@ h1 { } h2 { font-size: 175%; - color: #404040; + color: #202020; } h3 { font-size: 150%; diff --git a/templates/base.html b/templates/base.html index 2515795..ec0a41a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -9,7 +9,8 @@ hacking, forensics, tor, anonymity, internet, society, luddite, futurism, lulz, fun, poetry, games, vidya, thoughts, random, homepage, email server, web server, sound, fury, shakespeare, - nothing, writing, audio, classical music, video game music"/> + nothing, writing, audio, classical music, video game music, + mjfernez, mjfernet, mike, fernez, mikefernez, michael"/> {% block css%} @@ -23,19 +24,19 @@ -

{{ title }}

+

{{ title }}

{% block content %} {% endblock %}

{{ errors }}

- {% if parent_dir != '/site/' %} + {% if parent_dir %}

Go up to parent folder ({{ parent_dir }})

{% endif %}
diff --git a/templates/index.html b/templates/index.html index c8356fe..b612c63 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,7 +2,7 @@ {% block content %}
{% if description %} -{% include cur_path + '/.description' %} +{% include '/site/' + cur_path + '/.description' %} {% endif %} {% if dirs %} diff --git a/views.py b/views.py index aed9f17..4a41248 100644 --- a/views.py +++ b/views.py @@ -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/") +@app.route("/") @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, -- cgit v1.2.3