Help with #get helper


#1

I’m having trouble with the {{#get}} helper, I must not be fully understanding it. I’m trying to display posts with different tags in different sections on the homepage. I set the homepage to a channel in the routes.yaml. If I use just {{#foreach}} then posts do show, but with the code below, nothing shows up. What am I doing wrong? Hoping someone else can see my newbie mistakes

<main class="content post-list" id="content">
    <h1>Header</h1>
        {{#get "posts" limit="3" filter="tag:hash-art"}}
            {{#foreach posts}}
                {{title}}
            {{/foreach}}
        {{/get}}
    <h1>Header</h1>
    {{#get "posts" limit="3" filter="tag:blog"}}
            {{#foreach posts}}
                {{title}}
            {{/foreach}}
        {{/get}}
</main>

#2

I guess that your theme doesn’t have API access.

Do you have the v2 API enabled in your theme’s package.json file?


#3

I had v2 enabled. I reuploaded the entire theme and the package.json had a lot of errors, I couldn’t really understand why, I had what it required. I copied and pasted from the starter theme I used until a majority of the errors went away, I refreshed and now the posts show up. So it works now!


closed #4

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.