diff options
-rw-r--r-- | templates/index.html | 4 | ||||
-rw-r--r-- | templates/site/thoughts/rants/.description | 1 | ||||
-rw-r--r-- | views.py | 8 |
3 files changed, 8 insertions, 5 deletions
diff --git a/templates/index.html b/templates/index.html index 4bbad1d..714db1c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,7 +1,9 @@ {% extends 'base.html' %} {% block content %} -<p>{{ description }}</p> +{% if description %} +{% include cur_path + '/.description' %} +{% endif %} {% if dirs %} <h3>Topics</h3> diff --git a/templates/site/thoughts/rants/.description b/templates/site/thoughts/rants/.description new file mode 100644 index 0000000..33f8ee8 --- /dev/null +++ b/templates/site/thoughts/rants/.description @@ -0,0 +1 @@ +<img src="https://www.pngfind.com/pngs/m/436-4365661_disapproval-guy-text-face-astonished-what-man-disapproval.png" /> @@ -41,13 +41,13 @@ def index_dir(path): Lists are sorted alphabetically. *Special files include '.links' and '.description' the format of these - files is unquoted CSV and free text. Both are displayed on the index.html + files is unquoted CSV and text/html. Both are displayed on the index.html for the given `path` """ dirs = [] files = [] links = [] - description = "" + description = False contents = os.listdir(path) for obj in contents: if os.path.isfile(path + '/' + obj): @@ -55,8 +55,7 @@ def index_dir(path): with open(path + '/' + obj) as f: links = f.readlines() elif obj == siteconfig.DESC_FILE: - with open(path + '/' + obj) as f: - description = f.read() + description = True elif obj.startswith('.'): continue else: @@ -140,6 +139,7 @@ def render_file(path): dirs, files, links, description = index_dir(abs_path) context.update( { + 'cur_path': 'site/' + path, 'cur_dir': path.split('/')[-1] + '/', 'dirs': dirs, 'files': files, |