`{{#get "posts" limit="all"}}` returns nothing


#1

When get is added ahead of the loop, nothing is returned in the template. It should be noted that the query already has a tag filter applied in routes.yml as part of a collection.

  {{#get "posts" limit="all"}}
    {{#foreach posts}}

        {{> photoitem}}

    {{/foreach}}
  {{/get}}

#2

I assume that you are using v0.1 API and the public API is disabled. Your server log will tell you.
I recommend using the Content API v2.


#3

I’m using the latest docker image. Does it use v0.1 or v2?

package.json

...
  "engines": {
    "node": "^6.9.0 || ^8.9.0 || ^10.13.0",
    "cli": "^1.9.0"
  },
...

#4

Later realized the docs are about the package.json file in the theme, not Ghost core.

The theme’s package.json has been updated to v2 of the API.

    "engines": {
        "ghost": ">=2.0.0",
        "ghost-api": "v2"
    },

Docker was restarted and the theme reloaded. For some reason, the result is the same.

Interestingly changing config.posts_per_page also appears to have no effect. The version also isn’t reflected in Ghost admin (just shows 1.0). Could it be that it’s not being properly loaded by ghost?


#5

Are you sure you are editing the right theme, which is activated?