grav-theme-future2021/templates/default.html.twig

49 lines
1.4 KiB
Twig
Executable file

{% extends 'partials/base.html.twig' %}
{# Define if the primary image and the attributes of width and height are shown #}
{% set show_image = header_var('show_pageimage')|defined(true) %}
{% set image = page.media[page.header.primaryImage] ?: page.media.all|filter((v, k) => k != page.header.primaryImage and (v.type == 'image' or v.type == 'vector'))|first %}
{% set img_width = header_var('image_width')|default(1038) %}
{% set img_height = header_var('image_height')|default(437) %}
{# Set title and subtitle #}
{% set title = page.title|raw %}
{% set subtitle = page.header.subtitle|raw %}
{% block menu %}
{% include 'partials/sidebar_right.html.twig' %}
{% endblock %}
{% block content %}
<article class="post">
<header>
<div class="title">
<h2>{{ title }}</h2>
{% if subtitle %}
<p>{{ subtitle }}</p>
{% endif %}
</div>
</header>
{% if show_image and image %}
<span class="image featured">
{{ image.cropZoom(img_width, img_height).loading('lazy').attribute('decoding','async').html(title, title)|raw }}
</span>
{% endif %}
{{ page.content|raw }}
</article>
{% if show_sidebar == false %}
<section id="footer" class="align-center">
{% include 'partials/footer.html.twig' %}
</section>
{% endif %}
{% endblock %}
{% block sidebar %}
{% if show_sidebar == true %}
{% include 'partials/sidebar_left.html.twig' %}
{% endif %}
{% endblock %}