-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Themes: get helper, querying by slug not working #8245
Comments
Hey @thorsten-panknin 👋 This doesn't work for me neither. Sorry for trouble. A workaround for you would be to use the following syntax:
There is no problem with the result of the api response, the post is there, just the |
As I put in Slack, I did a quick investigation and am pretty baffled. This has NEVER worked. It seems I confused myself. Section 4.1 of this issue: #5993 explains the problem correctly. The documentation is totally not correct 😞 If you use a blockParam like
Although it does switch between doing either a read or browse request as the docs suggest, the response format is identical. Both return an array, even though the read request only returns a single item. There is no flattening or extra handling, so unless you use a block param as described above, you would need to use I am absolutely not sure how I managed to confuse myself here, but this is effectively an error in the documentation - all responses from the get helper are entirely consistent so the documentation is just confusing things! Gonna count this as a docs bug & fix the docs to say that all results are the same. |
Same problem with querying by id in the documentation. Should be updated. |
I have updated http://themes.ghost.org/docs/get and http://themes.ghost.org/v0.11.9/docs/get 👍 Thanks again for the report 😎 |
Issue Summary
The get helper doesn't seem to work with the find-by-slug example from the docs.
{{#get "posts" slug="welcome-to-ghost"}} {{#post}} <h2><a href="{{slug}}">{{title}}</a></h2> <div class="post-content"> {{content}} </div> {{/post}} {{/get}}
Steps to Reproduce
Nothing is output. I tried the tag cloud example from the docs which worked fine.
Technical details:
The text was updated successfully, but these errors were encountered: