Updated blog_item template to remove duplicate CSS classes in main image and redefined author variable.

This commit is contained in:
pmoreno.rodriguez 2023-01-04 15:49:49 +01:00
parent 7c8526864e
commit 656c2a59e4

View file

@ -1,87 +1,96 @@
<article class="post" itemprop="liveBlogUpdate" itemscope itemtype="http://schema.org/BlogPosting">
{% if page.header.author %}
{% set author = page.header.author %}
{% else %}
{% set author = page.header.taxonomy.author[0] %}
{% endif %}
{% if author %}
<article class="post" itemprop="liveBlogUpdate" itemscope itemtype="http://schema.org/BlogPosting">
{% if page.header.metadata.author %}
{% set author = page.header.metadata.author %}
{% elseif page.header.author %}
{% set author = page.header.author %}
{% else %}
{% set author = page.header.taxonomy.author[0] %}
{% endif %}
{% if author %}
{% set avatar = author|replace(' ', '-')|lower %}
{% endif %}
<header>
{% endif %}
<header>
<div class="title">
{% if page.header.link %}
<h2 itemprop="headline">
{% if page.header.continue_link is not sameas(false) %}
<a href="{{ page.url }}"></a>
{% if page.header.link %}
<h2 itemprop="headline">
{% if page.header.continue_link is not sameas(false) %}
<a href="{{ page.url }}"></a>
{% endif %}
<a href="{{ page.header.link }}">{{ page.title }}</a>
</h2>
{% else %}
<h2 itemprop="headline"><a href="{{ page.url }}">{{ page.title }}</a></h2>
{% endif %}
{% if page.header.subtitle %}
<p itemprop="alternativeHeadline">{{ page.header.subtitle|raw }}</p>
{% endif %}
<a href="{{ page.header.link }}">{{ page.title }}</a>
</h2>
{% else %}
<h2 itemprop="headline"><a href="{{ page.url }}">{{ page.title }}</a></h2>
{% endif %}
{% if page.header.subtitle %}
<p itemprop="alternativeHeadline">{{ page.header.subtitle|raw }}</p>
{% endif %}
</div>
<div class="meta">
<time class="published" itemprop="datePublished" datetime="{{page.date|dateTranslate(grav.config.system.pages.dateformat.short)}}">{{ page.date|dateTranslate(grav.config.system.pages.dateformat.short)}}</time>
{% if author %}
<a href="{{ base_url }}/author{{ config.system.param_sep }}{{ author }}" itemprop="keywords" class="author">{{ tag }}<span class="name" rel="author">{{ author }}</span>{% if page.header.avatarImage %}<img src="{{ page.media[page.header.avatarImage].url|e}}" alt="{{ author }}" />{% endif %}</a>
{% endif %}
<time class="published" itemprop="datePublished" datetime="{{page.date|date("Y-m-d")}}">{{ page.date|date("M j, Y")}}</time>
{% if author %}
<a href="{{ base_url }}/author{{ config.system.param_sep }}{{ author }}" itemprop="keywords" class="author">{{ tag }}<span class="name" rel="author">{{ author }}</span>{% if page.header.avatarImage %}<img src="{{ page.media[page.header.avatarImage].url|e}}" alt="{{ author }}" />{% endif %}</a>
{% endif %}
</div>
</header>
</header>
{% if page.header.primaryImage %}
<a href="{{ page.url }}" class="image featured">{{ page.media[page.header.primaryImage].cropZoom(1038,437).loading('lazy').html(page.title, page.title, 'image featured')|raw }}</a>
{% elseif page.media.images %}
<a href="{{ page.url }}" class="image featured">{{ page.media.images|first.cropZoom(1038,437).loading('lazy').html(page.title, page.title, 'image featured')|raw }}</a>
{% endif %}
{% if page.header.primaryImage %}
<a href="{{ page.url }}">{{ page.media[page.header.primaryImage].cropZoom(1038,437).loading('lazy').html(page.title, page.title, 'image featured')|raw }}</a>
{% else %}
<a href="{{ page.url }}">{{ page.media.images|first.cropZoom(1038,437).loading('lazy').html(page.title, page.title, 'image featured')|raw }}</a>
{% endif %}
{% if page.header.blog_hide_body is not defined or not page.header.blog_hide_body %}
<div itemprop="articleBody">
{% if page.header.continue_link is sameas(false) %}
{{ page.content|raw }}
{% if not truncate %}
{% set show_prev_next = true %}
{% endif %}
{% elseif truncate and page.summary != page.content %}
{{ page.summary|raw }}
{% elseif truncate %}
{{ page.content|truncate(550)|raw }}
{% else %}
{{ page.content|raw }}
{% set show_prev_next = true %}
{% endif %}
</div>
{% endif %}
<div itemprop="articleBody">
{% if page.header.continue_link is sameas(false) %}
{{ page.content|raw }}
{% if not truncate %}
{% set show_prev_next = true %}
{% endif %}
{% elseif truncate and page.summary != page.content %}
{{ page.summary|raw }}
{% elseif truncate %}
{{ page.content|truncate(550)|raw }}
{% else %}
{{ page.content|raw }}
{% set show_prev_next = true %}
{% endif %}
<footer>
</div>
<footer>
<ul class="actions">
{% if truncate and page.summary != page.content %}
<li><a href="{{ page.url }}" class="button">{{'FUTURE.BLOG.ITEM.CONTINUE_READING'|t}}</a></li>
<li><a href="{{ page.url }}" class="button">{{'FUTURE.BLOG.ITEM.CONTINUE_READING'|t}}</a></li>
{% elseif truncate %}
<li><a href="{{ page.url }}" class="button">{{'FUTURE.BLOG.ITEM.CONTINUE_READING'|t}}</a></li>
<li><a href="{{ page.url }}" class="button">{{'FUTURE.BLOG.ITEM.CONTINUE_READING'|t}}</a></li>
{% endif %}
{% if show_prev_next %}
{% if not page.isLast %}
<li><a class="button" href="{{ page.prevSibling.url }}"><i class="fa fa-chevron-left"></i> {{'FUTURE.BLOG.ITEM.PREV_POST'|t}}</a></li>
{% endif %}
{% if not page.isFirst %}
<li><a class="button" href="{{ page.nextSibling.url }}">{{'FUTURE.BLOG.ITEM.NEXT_POST'|t}} <i class="fa fa-chevron-right"></i></a></li>
{% endif %}
{% if not page.isLast %}
<li><a class="button" href="{{ page.prevSibling.url }}"><i class="fa fa-chevron-left"></i> {{'FUTURE.BLOG.ITEM.PREV_POST'|t}}</a></li>
{% endif %}
{% if not page.isFirst %}
<li><a class="button" href="{{ page.nextSibling.url }}">{{'FUTURE.BLOG.ITEM.NEXT_POST'|t}} <i class="fa fa-chevron-right"></i></a></li>
{% endif %}
{% endif %}
</ul>
<ul class="stats">
{% if page.taxonomy.tag %}
{% for tag in page.taxonomy.tag %}
<li><a href="{{ base_url }}/tag{{ config.system.param_sep }}{{ tag }}" itemprop="keywords">{{ tag }}</a></li>
{% endfor %}
{% endif %}
<li><a href="https://twitter.com/share" data-url="{{ page.url(true) }}" data-text="{{ page.title }}" class="icon brands fa-twitter"></a></li>
<li><a href="http://www.facebook.com/sharer.php?u={{ page.url(true) }}" class="icon brands fa-facebook"></a></li>
</ul>
</footer>
</article>
<ul class="stats">
{% if page.taxonomy.tag %}
{% for tag in page.taxonomy.tag %}
<li><a href="{{ base_url }}/tag{{ config.system.param_sep }}{{ tag }}" itemprop="keywords">{{ tag }}</a></li>
{% endfor %}
{% endif %}
<li><a href="https://twitter.com/share" data-url="{{ page.url(true) }}" data-text="{{ page.title }}" class="icon brands fa-twitter">
</a></li>
<li><a href="http://www.facebook.com/sharer.php?u={{ page.url(true) }}" class="icon brands fa-facebook">
</a></li>
</ul>
</footer>
</article>