leilukin-tumbleblog/themes/virgula/pages/index.twig

53 lines
1.6 KiB
Twig

{% extends "layouts" ~ DIR ~ "default.twig" %}
{% block content %}
{% if reason is not defined %}{# Some modules define reason in error states #}
{% if posts.paginated is not empty %}
<h2>{{ "Posts" | translate }}</h2>
<ul>
{% for post in posts.paginated %}
<li>
<a href="{{ post.url() }}" rel="bookmark" title="{{ 'Permanent link to &#8220;%s&#8221;' | translate | format(post.title() | striptags | fix(true)) }}">
{{ post.title() }}
</a>
</li>
{% endfor %}
{% if posts.prev_page() or posts.next_page() %}
<li>
<a href="{{ url('archive') }}" rel="archives">{{ "More posts&hellip;" | translate }}</a>
</li>
{% endif %}
</ul>
{% endif %}
{% set pages_list = theme.pages_list() %}
{% if pages_list is not empty %}
<h2>{{ "Pages" | translate }}</h2>
<ul>
{% for item in pages_list %}
{% set prev_page_depth = loop.first ? 1 : pages_list[loop.index0 - 1].depth %}
{% set this_page_depth = pages_list[loop.index0].depth %}
{% set next_page_depth = loop.last ? 1 : pages_list[loop.index0 + 1].depth %}
{% if this_page_depth > prev_page_depth %}
{{ "<ul><li>" | repeat(this_page_depth - prev_page_depth) }}
{% endif %}
{% if this_page_depth <= prev_page_depth %}
<li>
{% endif %}
<a href="{{ item.url() }}">{{ item.title }}</a>
{% if this_page_depth > next_page_depth %}
{{ "</li></ul>" | repeat(this_page_depth - next_page_depth) }}
{% endif %}
{% if this_page_depth >= next_page_depth %}
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% if posts.paginated is empty and pages_list is empty %}
<div role="status">{{ "Nothing here yet!" | translate }}</div>
{% endif %}
{% else %}
<div role="status">{{ reason }}</div>
{% endif %}
{% endblock %}