Seznam tagů z kategorie

This commit is contained in:
Emil Miler 2022-08-19 18:19:11 +02:00
parent fbba83194e
commit ce7460686e
3 changed files with 32 additions and 10 deletions

View File

@ -1,6 +1,5 @@
.taglist .tag {
margin-right: $tag-margin-right;
padding:$tag-padding;
background: $tag-background;
color: $tag-color;
border-radius: $tag-border-radius;
@ -9,10 +8,16 @@
display: inline-block;
a {
display: block;
color: $tag-color;
white-space: nowrap;
padding: $tag-padding;
&:hover {
color:lighten($anchor-hover-color,40);
color: $primary;
}
}
}
.taglist.centering {
justify-content: center;
}

View File

@ -3,6 +3,9 @@
{% block content %}
<main>
<h2>{{ term.name | capitalize() }}</h2>
<div class="taglist centering">
{{ macro::tags_in_category() }}
</div>
<hr>
<section class="list">
{% for page in term.pages %}

View File

@ -39,6 +39,20 @@
</ul>
{% endmacro subnav %}
{% macro tags_in_category() %}
{% set_global tags = [] %}
{% for page in term.pages %}
{% for tag in page.taxonomies.tagy %}
{% set_global tags = tags | concat(with=tag) %}
{% endfor %}
{% endfor %}
{% set_global tags = tags | sort | unique %}
{% for tag in tags %}
<span class="tag"><a href="{{ get_taxonomy_url(kind="tagy", name=tag) }}">{{ tag }}</a></span>
{% endfor %}
{% endmacro tags_in_category %}
{% macro recipe_image() %}
{% for asset in page.assets %}
{% if asset is matching("[img.](jpg|png)$") %}