I'm a Ghost beginner, and I know I can get the list of pages doing like below.
{{#get "pages"}}
{{#foreach pages}}
{{{html}}}
{{/foreach}}
{{/get}}
But am I able to fetch a specific page? Let's assume that I have an "about" page that I'd like to fetch in order to show its contents into the blog's sidebar, for example, this is what I tried, but it's not working.
{{#get "pages/slug/about" as page}}
{{page}} // prints undefined
{{/get}}
Any help would be much appreciated.
The first parameter passed to the #get
helper specifies the name of the resource you want to query. It should be either posts
, tags
or authors
. In your use case it should be posts
.
{{#get "posts" slug="pages/slug/about" as |post|}}
{{#post}}
<h1><a href="{{slug}}">{{title}}</a></h1>
<div class="post-content"> {{content}} </div>
{{/post}}
{{/get}}