zpwiki/themes/mytheme/templates/partials/authorposts.html.twig

59 lines
1.8 KiB
Twig
Raw Permalink Normal View History

2020-10-03 09:40:01 +00:00
{% set blist = [] %}
2020-10-03 15:04:37 +00:00
{% set catlist = taxonomy.taxonomy["category"]|keys %}
2020-10-03 09:40:01 +00:00
{% 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 %}
2020-10-03 15:01:21 +00:00
{% for cat in catlist %}
{% set catpages = taxonomy.findTaxonomy({'author': author,'category':cat}).order('date', 'desc') %}
2020-10-03 15:10:51 +00:00
{% if catpages|length > 0 %}
<h2> <a href="/categories/{{cat}}">{{ cat }} </a></h2>
<ul>
{% for p in catpages %}
<li><a href="{{p.url}}">{{ p.title|e }}</a></li>
{% endfor %}
</ul>
{% endif %}
2020-10-03 15:01:21 +00:00
{% endfor %}
2020-10-03 09:40:01 +00:00
{% 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 %}
2020-10-03 14:35:54 +00:00
{% set pages = tmplst|slice(0,maxcount) %}
2020-10-03 09:40:01 +00:00
<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>
2020-10-03 14:39:26 +00:00
{% set catlist = [] %}
2020-10-03 14:41:16 +00:00
{% for cat in p.taxonomy.category %}
2020-10-03 14:44:02 +00:00
{% set catlist = catlist|merge(['<small><a href="'~base_url~'/taxonomy?name=category&amp;val='~(cat|url_encode)~'">'~cat~'</a></small>']) %}
2020-10-03 14:39:26 +00:00
{% endfor %}
<span>{{ catlist|join(', ') }}</span>
2020-10-03 09:40:01 +00:00
</li>
{% endfor %}
</ul>
</section>