mirror of
https://github.com/pmoreno-rodriguez/grav-theme-future2021.git
synced 2025-06-07 20:08:54 +00:00
Improved the definition of variables
Improved the definition of title, subtitle and image variables
This commit is contained in:
parent
11c82f8f60
commit
08e1b28e46
1 changed files with 9 additions and 7 deletions
|
@ -1,5 +1,9 @@
|
||||||
{% extends 'partials/base.html.twig' %}
|
{% extends 'partials/base.html.twig' %}
|
||||||
|
|
||||||
|
{% set image = page.media[page.header.primaryImage] ?: page.media.images|first %}
|
||||||
|
{% set title = page.title|raw %}
|
||||||
|
{% set subtitle = page.header.subtitle|raw %}
|
||||||
|
|
||||||
{% block menu %}
|
{% block menu %}
|
||||||
{% include 'partials/sidebar_right.html.twig' %}
|
{% include 'partials/sidebar_right.html.twig' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -8,17 +12,15 @@
|
||||||
<article class="post">
|
<article class="post">
|
||||||
<header>
|
<header>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<h2>{{ page.header.title }}</h2>
|
<h2>{{ title }}</h2>
|
||||||
{% if page.header.subtitle %}
|
{% if subtitle %}
|
||||||
<p>{{ page.header.subtitle }}</p>
|
<p>{{ subtitle }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{% if page.header.primaryImage %}
|
{% if image %}
|
||||||
{{ page.media[page.header.primaryImage].cropZoom(1038,437).loading('lazy').html(page.title, page.title, 'image featured')|raw }}
|
{{ image.cropZoom(1038,437).loading('lazy').html(title, title, 'image featured')|raw }}
|
||||||
{% else %}
|
|
||||||
{{ page.media.images|first.cropZoom(1038,437).loading('lazy').html(page.title, page.title, 'image featured')|raw }}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ page.content|raw }}
|
{{ page.content|raw }}
|
||||||
|
|
Loading…
Add table
Reference in a new issue