Hello all.
I’m facing a problem that I can’t solve (due to inexperience, of course) and I’ll try to describe it the best I can.
So, I’m using the Gateway theme and it has a feature where it shows every post from a specific taxonomy type (“featured”) on the front page. This is done through a modular.html.twig template and is a functionality I’d like to keep.
The problem is that the results from other taxonomy types, i.e. posts by author, show up on a page that uses the same template and, since not every post is “featured”, the ones that are not don’t appear.
What I would like to do (if possible) is to adjust the template and make it work like this: if the page is the front page, then show the “featured” posts (default functionality). And if the page is not the front page but one that contains taxonomy results, then show every matching post, “featured” or not.
Alternatively, I would like help in creating a new template that will be used as a base by every page that contains taxonomy results.
As always, I don’t expect someone to come up with a full solution and make it easy for me. Every bit of help or suggestion will be appreciated.
I’m posting the full content of the aforementioned modular template, just for reference:
{% extends 'partials/base.html.twig' %}
{% set featured = page.collection({'items':{'@taxonomy.featured': true},'order': {'by': 'date', 'dir': 'desc'}}) %}
{% block header %}
{% include 'partials/header.html.twig' %}
{% endblock %}
{% block content %}
<div class="home_posts_titles">
<div class="row">
<div class="large-12 columns">
{{ page.content }}
</div>
</div>
</div>
{% if featured %}
<div class="featured-posts">
{% for row in featured|batch(3) %}
<div class="row">
{% for child in row %}
<div class="large-4 columns">
{% include 'partials/blog_item.html.twig' with {'page':child, 'truncate':true, 'readmore': false} %}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
{% endif %}
<hr>
{% for module in page.collection() %}
{{ module.content }}
{% endfor %}
{% endblock %}