grav/themes/quark/templates/partials/taxonomylist.html.twig

37 lines
1001 B
Twig
Raw Normal View History

2023-01-10 22:14:16 +01:00
2023-01-10 20:14:28 +01:00
{% if "events" in page.url %}
2023-01-10 22:04:21 +01:00
{% set tagList = [] %}
2023-01-10 21:55:01 +01:00
{% for item in page.collection %}
2023-01-10 22:10:56 +01:00
{% for tag in page.collection.taxonomy(taxonomy) %}
2023-01-10 22:04:21 +01:00
{% if tag not in tagList %}
2023-01-10 22:06:20 +01:00
{% set tagList = tagList|set([tag]) %}
2023-01-10 21:55:01 +01:00
{% endif %}
2023-01-10 21:28:33 +01:00
{% endfor %}
2023-01-10 21:55:01 +01:00
{% endfor %}
2023-01-10 22:06:20 +01:00
2023-01-10 22:10:56 +01:00
2023-01-10 22:04:21 +01:00
{% set tagCounts = taxonomylist.get(tagList) %}
{% set sorted_tags = tagCounts|sort( 'count' ) %}
2023-01-10 22:13:15 +01:00
2023-01-10 22:04:21 +01:00
<ul>
2023-01-10 22:15:08 +01:00
{% for tag in sorted_tags %}
2023-01-10 22:04:21 +01:00
<li>{{ tag.name }} ({{ tag.count }} mal verwendet)</li>
{% endfor %}
2023-01-10 21:51:39 +01:00
</ul>
2023-01-10 21:28:33 +01:00
2023-01-10 22:04:21 +01:00
2023-01-10 20:03:24 +01:00
{% else %}
2023-01-10 20:38:30 +01:00
{% set taxlist = children_only is defined ? taxonomylist.getChildPagesTags() : taxonomylist.get() %}
2023-01-10 20:03:24 +01:00
{% endif %}
2023-01-10 20:13:33 +01:00
{% if taxlist %}
2023-01-10 21:46:02 +01:00
<span class="tags">2
{% for tax,value in taxlist[taxonomy] %}
{% set label_class = uri.param(taxonomy) == tax ? 'label-primary' : 'label-secondary' %}
<a class="label label-rounded {{ label_class }}" href="{{ base_url }}/{{ taxonomy }}{{ config.system.param_sep }}{{ tax }}">{{ tax }}</a>
{% endfor %}
</span>
{% endif %}