This commit is contained in:
SG
2025-06-11 14:30:44 +03:00
parent eeb1462210
commit 7bbbd2e8ad
3 changed files with 21 additions and 13 deletions

View File

@@ -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'))