Cant access pages created with page- prefix

I’m developing a theme to use with ghost and I noticed that creating pages with page prefix is not working.

Steps:
In my content/themes/my-theme/ I created a file called page-blog.hbs
After restarting ghost, the page content did not show when accessing localhost:2368/blog (404)
I tried changing the name blog to other names and it did not work too.

I would really appreciate some help :slight_smile:

Node: v10.13.0
Ghost-CLI version: 1.11.0
Ghost version: 2.30.2
Debian

You need to create a page in Ghost Admin with the same slug as your custom template.

The page-{slug}.hbs files in a theme are for custom templates, not to automatically create pages

2 Likes

Thank you very much! That worked. :slight_smile:

But I can’t use {{#foreach posts}} inside the hbs file. I tried using #get but I need pagination in this page.

Is it possible to iterate through the posts inside a custom template?

You could definitely iterate over posts that you fetch, but the context you’re giving makes me think you’re trying to have a custom home page - for something like that, custom post templates aren’t really useful. You could use dynamic routing though: