From 6275fc3694f762f1bc2120f801b599ab68e2b9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Sat, 16 Sep 2023 18:42:01 +0200 Subject: [PATCH] Fix linking to blog articles from index. --- scripts/blog.py | 7 +++++-- static/blog_index.tmpl.html | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/blog.py b/scripts/blog.py index 74a5800..7ddc083 100644 --- a/scripts/blog.py +++ b/scripts/blog.py @@ -207,6 +207,7 @@ def render_index(docs, dest_top): "post_publication_date": front_matter['date'], "post_tags": split_tags(front_matter['tags']), "summary": summarize(doc), + "link": out_path.rstrip('/') + '/', } for (doc, front_matter, out_path) in page ] @@ -232,7 +233,9 @@ def regen_all(source_top, dest_top, docs=None): doc_full_path = os.path.join(dest_top, out_path) os.makedirs(os.path.dirname(doc_full_path), exist_ok=True) # print("==", doc_full_path) - with open(doc_full_path + '.html', 'wt') as f: + out_path = doc_full_path + '/index.html' + os.makedirs(os.path.dirname(out_path), exist_ok=True) + with open(out_path, 'wt') as f: try: render_article(doc, front_matter, f) except: @@ -325,7 +328,7 @@ def main(source_top, dest_top): doc_full_path = os.path.join(dest_top, out_path) os.makedirs(os.path.dirname(doc_full_path), exist_ok=True) # print("==", doc_full_path) - with open(doc_full_path + '.html', 'wt') as f: + with open(doc_full_path + '/index.html', 'wt') as f: try: render_article(doc, front_matter, f) except: diff --git a/static/blog_index.tmpl.html b/static/blog_index.tmpl.html index 4be44b9..7ba8570 100644 --- a/static/blog_index.tmpl.html +++ b/static/blog_index.tmpl.html @@ -30,7 +30,7 @@ {% for post in posts %}