Skip to content

Commit

Permalink
refactored all categories from page layout to a sidebar on blog-categ…
Browse files Browse the repository at this point in the history
…ory.html
  • Loading branch information
Queen-codes committed Dec 31, 2024
1 parent e769ff1 commit 842d2dd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
25 changes: 15 additions & 10 deletions themes/vocabulary_theme/templates/blog-category.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@

{% block title %}{{ this.name }}{% endblock %}

{% from "macros/categories.html" import render_categories %}

{% block body %}
<div class="all-categories">
<div class="header">
<div class="container">
<h1>All posts categorized "{{ this.name }}"</h1>
<a class="button small margin-top-bigger" href="{{ this.parent|url }}">See all categories</a>
</div>
</div>
<div class="categories-list container">
{{ render_posts(this.children) }}
</div>
<header>
<h1>Category: {{ this.name|capitalize }} </h1>
</header>

<aside class="sidebar">
<nav class="filter-menu" aria-labelledby="categories">
<h2>Categories</h2>
{{ render_categories(this.parent) }}
</nav>
</aside>

<div>
{{ render_posts(this.children) }}
</div>
{% endblock %}
10 changes: 7 additions & 3 deletions themes/vocabulary_theme/templates/macros/categories.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{% from "macros/posts.html" import render_posts %}

{% macro render_categories(categories) %}
{% for category in site.query(categories.path) %}
<a class="button tag margin-vertical-small margin-horizontal-smaller" href="{{ category|url }}">{{ category.name }}</a>
{% endfor %}
<ul>
{% for category in site.query(categories.path) %}
<li>
<a href="{{ category|url }}">{{ category.name }}</a>
</li>
{% endfor %}
</ul>
{% endmacro %}

0 comments on commit 842d2dd

Please sign in to comment.