Fix linking to blog articles from index.

This commit is contained in:
Sergio Martínez Portela 2023-09-16 18:42:01 +02:00
parent 59c9dfcf6b
commit 6275fc3694
2 changed files with 6 additions and 3 deletions

View File

@ -207,6 +207,7 @@ def render_index(docs, dest_top):
"post_publication_date": front_matter['date'], "post_publication_date": front_matter['date'],
"post_tags": split_tags(front_matter['tags']), "post_tags": split_tags(front_matter['tags']),
"summary": summarize(doc), "summary": summarize(doc),
"link": out_path.rstrip('/') + '/',
} }
for (doc, front_matter, out_path) in page 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) doc_full_path = os.path.join(dest_top, out_path)
os.makedirs(os.path.dirname(doc_full_path), exist_ok=True) os.makedirs(os.path.dirname(doc_full_path), exist_ok=True)
# print("==", doc_full_path) # 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: try:
render_article(doc, front_matter, f) render_article(doc, front_matter, f)
except: except:
@ -325,7 +328,7 @@ def main(source_top, dest_top):
doc_full_path = os.path.join(dest_top, out_path) doc_full_path = os.path.join(dest_top, out_path)
os.makedirs(os.path.dirname(doc_full_path), exist_ok=True) os.makedirs(os.path.dirname(doc_full_path), exist_ok=True)
# print("==", doc_full_path) # print("==", doc_full_path)
with open(doc_full_path + '.html', 'wt') as f: with open(doc_full_path + '/index.html', 'wt') as f:
try: try:
render_article(doc, front_matter, f) render_article(doc, front_matter, f)
except: except:

View File

@ -30,7 +30,7 @@
{% for post in posts %} {% for post in posts %}
<div class="post-container"> <div class="post-container">
<article class="post"> <article class="post">
<h2 class="post-title">{{ post.title }}</h2> <h2 class="post-title"><a href="{{ post.link }}">{{ post.title }}</a></h2>
<div class="post-metadata"> <div class="post-metadata">
<time datetime="{{ post.post_publication_date }}"> <time datetime="{{ post.post_publication_date }}">
{{ post.post_publication_date }} {{ post.post_publication_date }}