Improved the definition of variables.

Improved the definition of title, subtitle and image variables.
This commit is contained in:
pmoreno.rodriguez 2023-02-03 23:10:09 +01:00 committed by GitHub
parent 72440d8d27
commit 43b0da2882
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,16 +1,13 @@
<section> <section>
<ul class="posts"> <ul class="posts">
{% for p in page.find(theme_config.blog_page).children.order('date', 'desc').slice(0, 5) %} {% for p in page.find(theme_config.blog_page).children.order('date', 'desc').slice(0, 5) %}
{% if p.header.primaryImage %} {% set image = p.media[p.header.primaryImage] ?: p.media.images|first %}
{% set bannerimage = p.media[p.header.primaryImage]%} {% set title = p.title|raw %}
{% else %}
{% set bannerimage = p.media.images|first %}
{% endif %}
<li> <li>
<article> <article>
<header> <header>
<h3> <h3>
<a href="{{p.url}}">{{ p.title }}</a> <a href="{{p.url}}">{{ title }}</a>
</h3> </h3>
{% if config.plugins["translate-date"].enabled %} {% if config.plugins["translate-date"].enabled %}
<time class="published" datetime="{{ p.date|td(null, "Y-m-d") }}">{{ p.date|td(null, "M j, Y") }}</time> <time class="published" datetime="{{ p.date|td(null, "Y-m-d") }}">{{ p.date|td(null, "M j, Y") }}</time>
@ -19,7 +16,7 @@
{% endif %} {% endif %}
</header> </header>
<a href="{{p.url}}" class="image"> <a href="{{p.url}}" class="image">
{{ bannerimage.cropZoom(64,64).quality(60).loading('lazy').html('',p.title)|raw }} {{ image.cropZoom(64,64).quality(60).loading('lazy').html(title,title)|raw }}
</a> </a>
</article> </article>
</li> </li>