Output posts on static pages

Hello guys,

Since I’m a WordPress Guy I am used to things like using Pages for different types of Posts (Maybe a customer wants to separate blog posts from works he has dome and so on). Anyway, I wanted to check out Ghost since WordPress isn’t very fast anymore, so Ghost looked like an alternative to WordPress, especially for smaller projects.

I’m new to Ghost, just started having a look from yesterday. Now it looks like Ghost isn’t able to output posts on static pages, correct me if I’m wrong.

Is there a solution to solve this problem?

So I’ve found a solution which makes it possible to output posts on static pages, with the {{#get}} helper:

{{#get "posts"}}
  {{#foreach posts}}
  ... do something with all featured pages...

The {{#foreach}} helper only loops through the data that is available, so once the post gets old enough to not be shown on page 1, you’ll no longer see the post if you use {{#foreach}} + {{#has}} .

The {{#get}} helper does a query to fetch the exact data you want, and then you can loop over it using the {{#foreach}} helper.

Equally, to get a post with a particular tag you could use: filter="tag:homepage" note that the value for the tag should be the slug value, if you want to use the tag’s name, then change to filter="tag.name:'Home Page'" .

1 Like

As you’ve found, the {{get}} helper is the traditional way of doing this.

However there is also the recently added dynamic routing feature which may cover more of your use cases such as fully separating blog posts (yoursite.com/blog/) from portfolio posts (yoursite.com/portfolio/) for example.


problem solved

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