dmytro_ushatenko/themes/mytheme/templates/partials/authorposts.html.twig
2020-10-03 17:04:37 +02:00

57 lines
1.7 KiB
Twig

{% set blist = [] %}
{% set catlist = taxonomy.taxonomy["category"]|keys %}
{% if grav.theme.config.params.articles.blacklist is defined %}
{% set blist = grav.theme.config.params.articles.blacklist %}
{% set tmplst = [] %}
{% for cat in catlist %}
{% if cat not in blist %}
{% set tmplst = tmplst|merge([cat]) %}
{% endif %}
{% endfor %}
{% set catlist = tmplst %}
{% endif %}
{% for cat in catlist %}
<h2> {{ cat }}</h2>
{% set catpages = taxonomy.findTaxonomy({'author': author,'category':cat}).order('date', 'desc') %}
<ul>
{% for p in catpages %}
<li><a href="{{p.url}}">{{ p.title|e }}</a></li>
{% endfor %}
</ul>
{% endfor %}
{% set pages = taxonomy.findTaxonomy({'author': author}).order('date', 'desc') %}
{% set tmplst = [] %}
{% for page in pages %}
{% set blisted = false %}
{% for bcat in blist %}
{% if bcat in page.taxonomy["category"] %}
{% set blisted = true %}
{% endif %}
{% endfor %}
{% if not blisted %}
{% set tmplst = tmplst|merge([page]) %}
{% endif %}
{% endfor %}
{% set pages = tmplst|slice(0,maxcount) %}
<section class="topiclist">
<ul>
{% for p in pages %}
{% if p.header.media == 'video' %}
<li class="video">
{% else %}
<li class="text">
{% endif %}
<a href="{{p.url}}">{{ p.title|e }}</a>
{% set catlist = [] %}
{% for cat in p.taxonomy.category %}
{% set catlist = catlist|merge(['<small><a href="'~base_url~'/taxonomy?name=category&amp;val='~(cat|url_encode)~'">'~cat~'</a></small>']) %}
{% endfor %}
<span>{{ catlist|join(', ') }}</span>
</li>
{% endfor %}
</ul>
</section>