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.")
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<div class="card h-100 rounded mx-1 my-3" style="width: 400px;">
|
||||
<div class="card-header">
|
||||
{% if content_item.image_file %}
|
||||
<img src="content/{{ content_item.image_file }}" alt="{{ content_item.title }}" class="card-img-top img-fluid mx-auto d-block object-fit-scale rounded" style="max-height: 200px; width: auto;">
|
||||
<img src="{{ parent_path }}content/{{ content_item.image_file }}" alt="{{ content_item.title }}" class="card-img-top img-fluid mx-auto d-block object-fit-scale rounded" style="max-height: 200px; width: auto;">
|
||||
{% else %}
|
||||
<img src="static/images/1x1.png" alt="{{ content_item.title }}" class="card-img-top img-fluid mx-auto d-block object-fit-scale rounded" style="height: 200px; width: auto;">
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user