updates - hidden items
This commit is contained in:
28
classes.py
28
classes.py
@@ -142,27 +142,29 @@ class Site:
|
||||
# Build categories map
|
||||
self.map_categories()
|
||||
|
||||
# Parse the content files
|
||||
# Render the content files
|
||||
logger.debug(f"Content items: {self.content_items}")
|
||||
for content_item in self.content_items:
|
||||
content_item.render_content(categories = 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, categories = self.categories))
|
||||
|
||||
# Render the categories indices
|
||||
for category in self.categories:
|
||||
print(F"CREATING CATEGORY {category}.html")
|
||||
category_index = Path(f"{self.output_dir}/categories/{category}.html")
|
||||
category_items = [i for i in self.content_items if category in i.data.get("categories")]
|
||||
with (category_index).open(mode="w", encoding="utf-8") as f:
|
||||
f.write(index_template.render(page_title=category, content_items=category_items, categories = self.categories, parent_path = '../'))
|
||||
|
||||
# Render the about file
|
||||
about_content = ContentItem(Path('static/about.md'))
|
||||
about_content.parse_content()
|
||||
about_content.render_content(categories = self.categories)
|
||||
|
||||
# Render the index file
|
||||
visible_content_items = [c for c in self.content_items if c.data.get("hidden") != True]
|
||||
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=visible_content_items, categories = self.categories))
|
||||
|
||||
# Render the categories indices
|
||||
visible_content_items = [c for c in self.content_items if c.data.get("hidden") != True]
|
||||
for category in self.categories:
|
||||
print(F"CREATING CATEGORY {category}.html")
|
||||
category_index = Path(f"{self.output_dir}/categories/{category}.html")
|
||||
category_items = [i for i in visible_content_items if category in i.data.get("categories")]
|
||||
with (category_index).open(mode="w", encoding="utf-8") as f:
|
||||
f.write(index_template.render(page_title=category, content_items=category_items, categories = self.categories, parent_path = '../'))
|
||||
|
||||
logger.info(f"Created {len(self.content_items)} content items.")
|
||||
|
||||
Reference in New Issue
Block a user