mirror of
https://github.com/pmoreno-rodriguez/grav-theme-future2021.git
synced 2025-06-07 20:08:54 +00:00
Templates archives and related pages redefined
This commit is contained in:
parent
7ed17be931
commit
2363970749
3 changed files with 68 additions and 37 deletions
38
templates/partials/archives.html.twig
Normal file → Executable file
38
templates/partials/archives.html.twig
Normal file → Executable file
|
@ -1,25 +1,13 @@
|
||||||
<section>
|
<ul class="alt">
|
||||||
<ul class="posts">
|
|
||||||
{% for p in page.find(theme_config.blog_page).children.order('date', 'desc').slice(0, 5) %}
|
{% for month,items in archives_data %}
|
||||||
{% set image = p.media[p.header.primaryImage] ?: p.media.images|first %}
|
<li>
|
||||||
{% set title = p.title|raw %}
|
<a href="{{ base_url }}/{{ config.plugins.archives.taxonomy_names.month }}{{ config.system.param_sep }}{{ month|date('M_Y')|lower|e('url') }}">
|
||||||
<li>
|
{% if archives_show_count %}
|
||||||
<article>
|
<span class="label label-circle">{{ items|length }}</span>
|
||||||
<header>
|
{% endif %}
|
||||||
<h3>
|
<span class="archive_date">{{ month|date(config.plugins.archives.date_display_format) }} </span>
|
||||||
<a href="{{p.url}}">{{ title }}</a>
|
</a>
|
||||||
</h3>
|
</li>
|
||||||
{% if config.plugins["translate-date"].enabled %}
|
{% endfor %}
|
||||||
<time class="published" datetime="{{ p.date|td(null, "Y-m-d") }}">{{ p.date|td(null, "M j, Y") }}</time>
|
</ul>
|
||||||
{% else %}
|
|
||||||
<time class="published" datetime="{{ p.date|date("Y-m-d") }}">{{ p.date|date("M j, Y") }}</time>
|
|
||||||
{% endif %}
|
|
||||||
</header>
|
|
||||||
<a href="{{p.url}}" class="image" aria-label="{{ title }}">
|
|
||||||
{{ image.cropZoom(64,64).quality(60).loading('lazy').attribute('decoding','async').html(title,title)|raw }}
|
|
||||||
</a>
|
|
||||||
</article>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
38
templates/partials/relatedpages.html.twig
Normal file → Executable file
38
templates/partials/relatedpages.html.twig
Normal file → Executable file
|
@ -1,13 +1,33 @@
|
||||||
<ul class="related-pages">
|
<section>
|
||||||
{% for related_path, score in related_pages %}
|
<ul class="posts">
|
||||||
|
{% for related_path, score in related_pages %}
|
||||||
{% set related = grav['pages'].get(related_path) %}
|
{% set related = grav['pages'].get(related_path) %}
|
||||||
|
{% set related_image = related.media.images[related.header.primaryImage] ?: related.media.all|filter((v, k) => k != related.header.avatarImage and (v.type == 'image' ))|first %}
|
||||||
|
|
||||||
{% if related %}
|
{% if related %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ related.url }}" title="{{ related.title }}">{{ related.title }}</a>
|
<article>
|
||||||
{% if config.plugins.relatedpages.show_score %}
|
{% if related.taxonomy.category is not null %}
|
||||||
<span class="score">( {{ score }} )</span>
|
<header>
|
||||||
{% endif %}
|
<h3><a class="" href="{{ related.url }}" title="{{ related.title }}" rel="nofollow">{{ related.title }}</a></h3>
|
||||||
</li>
|
<small class="published">
|
||||||
|
In <span class="catlist">
|
||||||
|
{% for category in related.taxonomy.category %}
|
||||||
|
<a class="" href="{{ new_base_url }}/category{{ config.system.param_sep }}{{ category }}">{{ category|raw }}</a>{% if not loop.last %}<span class="sep">, </span>{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</span>
|
||||||
|
</small>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
{% if related_image is not empty %}
|
||||||
|
<a class="image" aria-label="{{ related.title }}" href="{{ related.url }}">
|
||||||
|
{{ related_image.cropResize(64,64).loading('lazy').attribute('decoding','async').html|raw }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</article>
|
||||||
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
</section>
|
|
@ -1,3 +1,12 @@
|
||||||
|
{% set blog = page.find(header_var('blog_url')|defined(theme_var('blog_page'))) %}
|
||||||
|
{% set new_base_url = blog.url == '/' ? '' : blog.url %}
|
||||||
|
|
||||||
|
{% if uri.params %}
|
||||||
|
{% set feed_url = blog.url == '/' or blog.url == base_url_relative ? (uri.uri~'/'~blog.slug) : blog.url %}
|
||||||
|
{% else %}
|
||||||
|
{% set feed_url = blog.url == '/' or blog.url == base_url_relative ? (base_url_relative~'/'~blog.slug) : blog.url %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<section id="menu">
|
<section id="menu">
|
||||||
<div style="padding: 1.5em;"><a class="close" href="#menu" title="Menu"></a></div>
|
<div style="padding: 1.5em;"><a class="close" href="#menu" title="Menu"></a></div>
|
||||||
{% if config.plugins.simplesearch.enabled %}
|
{% if config.plugins.simplesearch.enabled %}
|
||||||
|
@ -10,16 +19,17 @@
|
||||||
<div id="sidebarmenu">
|
<div id="sidebarmenu">
|
||||||
{% include 'partials/sidebar_navigation.html.twig' %}
|
{% include 'partials/sidebar_navigation.html.twig' %}
|
||||||
</div>
|
</div>
|
||||||
{% if config.plugins.archives.enabled and archives_data is not empty %}
|
{% if config.plugins.archives.enabled and archives_data is not empty %}
|
||||||
<!-- Actions -->
|
<!-- Archives -->
|
||||||
<div>
|
<div>
|
||||||
<header>
|
<header>
|
||||||
<h3>{{ 'FUTURE.SIDEBAR.ARCHIVES.HEADLINE'|t }}</h3>
|
<h3>{{ 'FUTURE.SIDEBAR.ARCHIVES.HEADLINE'|t }}</h3>
|
||||||
</header>
|
</header>
|
||||||
{% include 'partials/archives.html.twig' %}
|
{% include 'partials/archives.html.twig' with {'base_url': new_base_url} %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if config.plugins.relatedpages.enabled and related_pages|length > 0 %}
|
{% if config.plugins.relatedpages.enabled and related_pages|length > 0 %}
|
||||||
|
<!-- Related posts -->
|
||||||
<div>
|
<div>
|
||||||
<header>
|
<header>
|
||||||
<h3>{{ 'FUTURE.SIDEBAR.RELATED_POSTS.HEADLINE'|t }}</h3>
|
<h3>{{ 'FUTURE.SIDEBAR.RELATED_POSTS.HEADLINE'|t }}</h3>
|
||||||
|
@ -28,6 +38,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if config.plugins.taxonomylist.enabled %}
|
{% if config.plugins.taxonomylist.enabled %}
|
||||||
|
<!-- Taxonomy list -->
|
||||||
<div>
|
<div>
|
||||||
<header>
|
<header>
|
||||||
<h3>{{ 'FUTURE.SIDEBAR.TAGS.HEADLINE'|t }}</h3>
|
<h3>{{ 'FUTURE.SIDEBAR.TAGS.HEADLINE'|t }}</h3>
|
||||||
|
@ -35,7 +46,19 @@
|
||||||
{% include 'partials/taxonomylist.html.twig' with {'base_url':new_base_url, 'taxonomy':'tag'} %}
|
{% include 'partials/taxonomylist.html.twig' with {'base_url':new_base_url, 'taxonomy':'tag'} %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if config.plugins.feed.enabled %}
|
||||||
|
<!-- Syndicate -->
|
||||||
|
<div class="sidebar-content syndicate">
|
||||||
|
<h4>{{ 'FUTURE.SIDEBAR.SYNDICATE.HEADLINE'|t }}</h4>
|
||||||
|
<ul class="actions">
|
||||||
|
<li><a href="{{ feed_url }}.atom"><i class="fa fa-rss-square"></i> Atom 1.0</a></li>
|
||||||
|
<li><a href="{{ feed_url }}.rss"><i class="fa fa-rss-square"></i> RSS</a></li>
|
||||||
|
{% if config.plugins.feed.enable_json_feed %}<li><a href="{{ feed_url }}.json"><i class="fa fa-rss-square"></i> JSON</a></li>{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% if config.plugins.login.enabled %}
|
{% if config.plugins.login.enabled %}
|
||||||
|
<!-- Login button -->
|
||||||
<div>
|
<div>
|
||||||
<ul class="actions stacked">
|
<ul class="actions stacked">
|
||||||
{% if not grav.user.authenticated %}
|
{% if not grav.user.authenticated %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue