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

View File

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

View File

@ -39,6 +39,20 @@
</ul> </ul>
{% endmacro subnav %} {% 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() %} {% macro recipe_image() %}
{% for asset in page.assets %} {% for asset in page.assets %}
{% if asset is matching("[img.](jpg|png)$") %} {% if asset is matching("[img.](jpg|png)$") %}