{% set homeroute = '/home' %} {% if grav.theme.config.params.articleroot is defined %} {% set homeroute = grav.theme.config.params.articleroot %} {% endif %} {% if grav.theme.config.params.articles.root is defined %} {% set homeroute = grav.theme.config.params.articles.root %} {% endif %} {% set options = { items: {'@page.descendants': homeroute}, 'order': {'by': 'date', 'dir': 'desc'}} %} {% set my_collection = page.collection(options) %} {% if config.get('plugins.page-toc.active') or attribute(page.header, 'page-toc').active %}
{% set table_of_contents = toc(page.content) %} {% if table_of_contents is not empty %}

Obsah

{{ table_of_contents }} {% endif %}
{% endif %} {% set catlist = taxonomy.taxonomy["category"]|keys %} {% set blist = [] %} {% 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 %} {% if grav.theme.config.params.sidebar.show.categories %}

{{ 'CATEGORIES'|t }}

{% endif %} {% set maxcount = 5 %} {% if grav.theme.config.params.sidebar.maxentries is defined %} {% set maxcount = grav.theme.config.params.sidebar.maxentries %} {% endif %} {% if grav.theme.config.params.sidebar.show.popular %}
{% set counts = viewcounts|sort|reverse %} {% set popular = [] %} {% for route,views in counts %} {% if route starts with homeroute %} {% set thispage = page.find(route) %} {% if thispage is not null %} {% set popular = popular|merge([thispage]) %} {% endif %} {% endif %} {% endfor %} {% set tmplst = [] %} {% for page in popular %} {% 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 popular = tmplst %}

{{ 'POPULAR_ARTICLES'|t }}

{% include 'partials/topiclist.html.twig' with {'articles': popular, 'maxcount': maxcount} %}
{% endif %} {% if grav.theme.config.params.sidebar.show.latest %}

{{ 'LATEST_ARTICLES'|t }}

{% set tmplst = [] %} {% for page in my_collection %} {% set blisted = false %} {% for bcat in blist %} {% if bcat in page.taxonomy["category"] or (page.header.published is defined and not page.header.published) %} {# Setting this to blacklisted when the category is in the blacklist OR if the page isn't yet published #} {% set blisted = true %} {% endif %} {% endfor %} {% if not blisted %} {% set tmplst = tmplst|merge([page]) %} {% endif %} {% endfor %} {% set articles = tmplst|slice(0,maxcount) %} {% include 'partials/topiclist.html.twig' with {'articles': articles, 'maxcount': maxcount} %}
{% endif %}