Dynamic Routing with static home page not working as expected

(duplicate on StackOverflow)

I have just set up a Ghost Blog. This is a clean install on a VPS, and it is up and running correctly.

By default, Ghost shows a list of posts when opened in the browser. I would like to have a home page at the / location, and have my posts available at /blog . From what I can tell, this can be achieved by using Dynamic Routing.

To simplify this, I thought I would be able to page as the home page . I could then render this page using the already existing page.hbs template.

Here is my routes.yaml file:

    data: page.home
      - page

    permalink: /blog/{slug}/
      - index

  tag: /blog/tag/{slug}/
  author: /blog/author/{slug}/

I have a page called home , but when I load the home page, I get an empty-ish page: just the footer displays.

There are no hints in the log that tells me what could be happening. Am I understanding routes.yaml correct? Is page.home not how to pass data to a page?

I’d suggest to use a new template for this.



I will update the docs to make this clear. Let me know if it works :slight_smile:

I was hoping I could use the already existing page.hbs template. Should it not be possible with this?

I don’t have to use a page, I could create a post and use that as my home page (via post.hbs). Would that work?


Hm yeah you could, but therefore you need to use the long-form.

      post: page.home

The reason you have to use {{#page}} by default is that Ghost automatically uses the resource type as name of the target object (page.home === page).

Let me know if it works. I have not tested it :slight_smile:

Awesome! That is exactly what I was looking for. Here is my routes.yaml

      post: page.home
    template: page

Thanking you :wave:


Actually, any reason why the headings wouldn’t be showing up now? Strange one


The <a> tags with the links exist in the HTML source, just not rendered correctly. I an using the default template.


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