summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2026-01-01 19:45:30 +0100
committerBotond Hende <nettingman@gmail.com>2026-01-01 19:45:30 +0100
commitf9c7a835cb6eb8f122d4ec18e3349ddd954f987d (patch)
tree3fbbdbf88cf2716ae3beb2fa23b4991c12b3b505 /modules
parent3399cf5c4f0a7a79c7903358ef1d6b024dcdfc08 (diff)
fixed index page generation on comic subdomain
Diffstat (limited to 'modules')
-rw-r--r--modules/comic_generate.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/comic_generate.py b/modules/comic_generate.py
index 8615f1f..1b895e0 100644
--- a/modules/comic_generate.py
+++ b/modules/comic_generate.py
@@ -56,7 +56,7 @@ def get_issues(path: str, local: bool) -> list[Issue]:
return_list.append(Issue(os.path.join(path, directory)))
- return_list.sort(key=lambda post: post.meta_data[PUBLISH_DATE_KEY], reverse=True)
+ return_list.sort(key=lambda post: post.meta_data[PUBLISH_DATE_KEY], reverse=False)
return return_list
@@ -73,7 +73,6 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool):
issues = get_issues(Config.ISSUE_SOURCE_DIR, local)
issue_template = jinja_env.get_template("issue.html.j2")
- last_render = None
last_issue_idx = len(issues) - 1
for idx, issue in enumerate(issues):
@@ -87,14 +86,14 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool):
"next": "/#" if idx == last_issue_idx else f"/issues/{str(idx + 2)}"
}
- last_render = issue_template.render(ctx)
with open(os.path.join(output_dir, "index.html"), "w") as f:
- f.write(last_render)
+ f.write(issue_template.render(ctx))
shutil.copyfile(os.path.join(issue.path, IMAGE_FILE_NAME), os.path.join(output_dir, IMAGE_FILE_NAME))
- with open(os.path.join(output_root_path, "index.html"), "w") as f:
- f.write(last_render)
+ if idx == last_issue_idx:
+ shutil.copy(os.path.join(output_dir, "index.html"), os.path.join(output_root_path, "index.html"))
+
shutil.copytree(Config.COMIC_ASSETS_SOURCE_DIR, output_root_path + Config.ASSETS_IMPORT_PATH)
rss_template = jinja_env.get_template("comic_feed.xml.j2")