I’m building a custom theme and have a custom home page set up. On that page I’d like to show a list of my tags as well as my three most recent posts.
Here’s my routes.yaml file:
routes:
/:
data: page.home
template: home
collections:
/articles/:
permalink: /{slug}/
template: index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
I’m using {{#get 'tags'}}
and {{#foreach tags}}
with no problem, but when I create the block to pull in recent posts, nothing shows up.
I have posts there, and can get them via the API, but not with the template tag. Here’s how I’m using it:
{{#get "posts"}}
{{#foreach posts}}
<h2 class="title">{{title}}</h2>
{{/foreach}}
{{/get}}
Any idea what I’m doing wrong? Are the posts not available in certain places or do I need to explicitly somehow make that data available with the data prop in routes?