grav/themes/quark-open-publishing/templates/partials/blog-item.html.twig

85 lines
3.2 KiB
Twig

<div class="content-item h-entry">
{% if not hero_image_name %}
<div class="content-title text-center">
{% include 'partials/blog/title.html.twig' with {title_level: 'h2'} %}
{% if not (grav.uri.param('hidepagetitle')) %}
{% if page.header.subtitle %}
<h3>{{ page.header.subtitle }}</h3>
{% endif %}
<p>
{% include 'partials/blog/date.html.twig' %}
{% if config.plugins.readingtime.enabled %}
<span class="blogitem__readingtime">{% include 'partials/blog/readingtime.html.twig' %}</span>
{% endif %}
</p>
{% include 'partials/blog/taxonomy.html.twig' %}
{% endif %}
</div>
{% endif %}
<div class="e-content">
{# check to hide post summary on page - hibbittsdesign.org #}
{% if page.parent.header.display_post_summary.enabled %}
{% set content = page.content|slice(page.summary | length) %}
{% else %}
{% set content = page.content %}
{% endif %}
{# check to show summary only - hibbittsdesign.org #}
{% if not (grav.uri.param('summaryonly') or grav.uri.param('onlysummary')) %}
{% if content is not empty %}
{{ content|raw }}
{% else %}
{{ page.summary|raw }}
{% endif %}
{% else %}
{{ page.summary|raw }}
{% if page.header.continue_link is same as(true) %}
<a href="{{ page.url ~ '/chromeless:true' }}" title="{{ page.title }}" class="btn btn-primary topwindow external-link">{{ 'THEME_QUARK.BLOG.ITEM.CONTINUE_READING'|t }}</a>
{% endif %}
{% endif %}
</div>
{% if config.plugins.comments.enabled %}
{% include 'partials/comments.html.twig' %}
{% endif %}
</div>
{# added check for content display flag - hibbittsdesign.org #}
{% if not (grav.uri.param('chromeless') or grav.uri.param('embedded') or grav.uri.param('standalone')) and not(theme_var('chromeless.enabled')) and not (grav.uri.param('summaryonly') or grav.uri.param('onlysummary')) %}
{% set currentPage = page %}
{% set allPages = [] %}
{% set currentPageIndex = 0 %}
{% for child in pages.children %}
{% set subPages = child.children %}
{% for subPage in subPages %}
{% set allPages = allPages|merge([subPage]) %}
{% endfor %}
{% endfor %}
{% set allPages = allPages|sort(modified, 'desc') %}
{% for i, page in allPages %}
{% if page.url == currentPage.url %}
{% set currentPageIndex = i %}
{% endif %}
{% endfor %}
<p class="prev-next text-center">
{% if currentPageIndex > 0 %}
<a class="btn" href="{{ allPages[currentPageIndex-1].url }}">
<i class="fa fa-angle-left"></i>
{{ 'THEME_QUARK.BLOG.ITEM.PREV_POST'|t }}
</a>
{% endif %}
{% if currentPageIndex < allPages|length-1 %}
<a class="btn" href="{{ allPages[currentPageIndex+1].url }}">{{ 'THEME_QUARK.BLOG.ITEM.NEXT_POST'|t }}
<i class="fa fa-angle-right"></i>
</a>
{% endif %}
</p>
{% endif %}