From 7bbbd2e8add9aef8fcdb944a25e80d2ea9af6d14 Mon Sep 17 00:00:00 2001 From: SG Date: Wed, 11 Jun 2025 14:30:44 +0300 Subject: [PATCH] updates --- classes.py | 9 +++------ templates/default.html | 10 ++++++++-- templates/index.html | 15 ++++++++++----- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/classes.py b/classes.py index 4412497..a4a973b 100644 --- a/classes.py +++ b/classes.py @@ -113,7 +113,8 @@ class Site: def map_categories(self): for content_item in self.content_items: for category in content_item.data.get("categories"): - self.categories[category].append(content_item.slug) + if not category == "default": + self.categories[category].append(content_item.slug) print(self.categories) def build(self): @@ -142,13 +143,9 @@ class Site: # Build categories map self.map_categories() - for category in self.categories: - with (self.output_dir / "categories.html").open(mode="w", encoding="utf-8") as f: - f.write(categories_index_template.render(page_title = Config.MAIN_PAGE_TITLE, categories_list = self.categories)) - # Render the index file with (self.output_dir / "index.html").open("w", encoding="utf-8") as f: - f.write(index_template.render(page_title = Config.MAIN_PAGE_TITLE, content_items=self.content_items)) + f.write(index_template.render(page_title = Config.MAIN_PAGE_TITLE, content_items=self.content_items, categories = self.categories)) # Render the about file about_content = ContentItem(Path('static/about.md')) diff --git a/templates/default.html b/templates/default.html index 470ef39..c062bc0 100644 --- a/templates/default.html +++ b/templates/default.html @@ -84,6 +84,12 @@ - {% block footer_includes %} - {% endblock %} + +
+
+ {% block footer_includes %} + {% endblock %} +
+

Page created with microgen

+
diff --git a/templates/index.html b/templates/index.html index 39e72ab..cf0a60f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,12 +7,17 @@ {% endblock %} {% block content %} - - -
-
+
+
+ {% for category in categories %} + {{ category }} + {% endfor %} +
+
+
+
{% for content_item in content_items %} -
+
{% if content_item.image_file %}