grav-theme-future2021/templates/blog.html.twig
2023-02-03 22:28:04 +01:00

82 lines
2.4 KiB
Twig

{% extends 'partials/base.html.twig' %}
{% set collection = page.collection() %}
{% set base_url = page.url %}
{% set feed_url = base_url %}
{% if page.header.show_breadcrumbs is defined %}
{% set show_breadcrumbs = page.header.show_breadcrumbs %}
{% else %}
{% set show_breadcrumbs = true %}
{% endif %}
{% if page.header.show_pagination is defined %}
{% set show_pagination = page.header.show_pagination %}
{% else %}
{% set show_pagination = true %}
{% endif %}
{% set image = page.media[page.header.primaryImage] ?: page.media.images|first %}
{% set title = page.title|raw %}
{# Set page title by taxonomy #}
{% if uri.param('category') %}
{% set listing_title = 'FUTURE.BLOG.LISTING_TITLE_CATEGORY'|t ~ uri.param('category') %}
{% elseif uri.param('tag') %}
{% set listing_title = 'FUTURE.BLOG.LISTING_TITLE_TAG'|t ~ uri.param('tag') %}
{% elseif uri.param('author') %}
{% set listing_title = 'FUTURE.BLOG.LISTING_TITLE_AUTHOR'|t ~ uri.param('author') %}
{% else %}
{% set listing_title = page.header.subtitle|raw %}
{% endif %}
{% if base_url == '/' %}
{% set base_url = '' %}
{% endif %}
{% if base_url == base_url_relative %}
{% set feed_url = base_url~'/'~page.slug %}
{% endif %}
{% block menu %}
{% include 'partials/sidebar_right.html.twig' %}
{% endblock %}
{% block content %}
<header>
<div class="title">
<h2>{{ title }}</h2>
{% if listing_title %}
<p>{{ listing_title|raw }}</p>
{% endif %}
</div>
</header>
{% if image %}
{{ image.cropZoom(1038,437).loading('lazy').html(title, title, 'image featured')|raw }}
{% endif %}
{{ page.content|raw }}
{% if show_breadcrumbs and config.plugins.breadcrumbs.enabled %}
{% include 'partials/breadcrumbs.html.twig' %}
{% endif %}
{% for child in collection %}
{% include 'partials/blog_item.html.twig' with {'page':child, 'truncate':true} %}
{% endfor %}
{% if show_pagination and config.plugins.pagination.enabled and collection.params.pagination %}
{% include 'partials/pagination.html.twig' with {base_url: page.url, pagination: collection.params.pagination} %}
{% endif %}
{% if theme_config.sidebar == false %}
<section id="footer" class="align-center">
{% include 'partials/footer.html.twig' %}
</section>
{% endif %}
{% endblock %}
{% block sidebar %}
{% if theme_config.sidebar == true %}
{% include 'partials/sidebar_left.html.twig' %}
{% endif %}
{% endblock %}