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): def map_categories(self):
for content_item in self.content_items: for content_item in self.content_items:
for category in content_item.data.get("categories"): 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) print(self.categories)
def build(self): def build(self):
@@ -142,13 +143,9 @@ class Site:
# Build categories map # Build categories map
self.map_categories() 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 # Render the index file
with (self.output_dir / "index.html").open("w", encoding="utf-8") as f: 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 # Render the about file
about_content = ContentItem(Path('static/about.md')) about_content = ContentItem(Path('static/about.md'))

View File

@@ -84,6 +84,12 @@
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.min.js" integrity="sha384-VHvPCCyXqtD5DqJeNxl2dtTyhF78xXNXdkwX1CZeRusQfRKp+tA7hAShOK/B/fQ2" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.min.js" integrity="sha384-VHvPCCyXqtD5DqJeNxl2dtTyhF78xXNXdkwX1CZeRusQfRKp+tA7hAShOK/B/fQ2" crossorigin="anonymous"></script>
{% block footer_includes %}
{% endblock %} <div class="container-fluid">
<div class="row">
{% block footer_includes %}
{% endblock %}
</div>
<div class="row small text-muted justify-content-end"><p class="mx-4">Page created with <a href="">microgen</a></p></div>
</div>
</body> </body>

View File

@@ -7,12 +7,17 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="container">
<!-- <div class="row row-cols-1 row-cols-md-3 row-cols-xxl-5 g-4 px-1 py-2"> --> <div class="row justify-content-around" style="margin-left: auto; margin-right: auto;">
<div class="container-fluid content-row"> {% for category in categories %}
<div class="row justify-content-start" style="margin-left: auto; margin-right: auto;"> <a href="categories/{{ category }}.html" class="mx-2">{{ category }}</a>
{% endfor %}
</div>
</div>
<div class="container-fluid content-row mx-auto">
<div class="row justify-content-start mx-auto">
{% for content_item in content_items %} {% for content_item in content_items %}
<div class="d-flex justify-content-center mx-2 mb-4"> <div class="d-flex justify-content-center mb-4">
<div class="card h-100 rounded mx-1 my-3" style="width: 400px;"> <div class="card h-100 rounded mx-1 my-3" style="width: 400px;">
<div class="card-header"> <div class="card-header">
{% if content_item.image_file %} {% if content_item.image_file %}