Hello,
On my homepage, I would like to use the lopp only for posts that have a specific tag.
On the same page, I have sections that display other posts (posts which do not have this specific tag).
Index.hbs :
{{!< default}}
{{>featured}}
<div class="loop-section">
{{>spotlight}}
<div class="loop-wrap">
<div>
{{>loop}}
</div>
</div>
</div>
{{pagination}}
{{>sections}}
loop.hbs
{{#foreach posts}}
{{#has tag="articles"}}
{{>loop_item}}
{{/has}}
{{/foreach}}
spotlight.hbs
{{#get "posts" limit="1" filter="tag:hash-spotlight" include="authors,tags" as |spotlights|}}
{{#if spotlights}}
{{#foreach spotlights}}
{{>spotlight_item}}
{{/foreach}}
{{/if}}
{{/get}}
Problem on the homepage â the âmore postsâ button (for the loop) is displayed all the time, even when there are no other posts to load (not surprising as I filter after loading the data).
So i Tried to filter before in routes.yaml:
routes.yaml
routes:
collections:
/:
permalink: /{slug}/
template: index
filter: tag:articles
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
But now the homepage links for posts that donât have the âarticlesâ tag no longer work (there is pictures and titles, only slugs seems broken and replaced by a kind of id).
I wonder if there is a way to filter posts in routes.yaml but load the data as if I needed all the posts ?