Showing custom home page in root URL

Hi,

I just created a self-hosted instance of Ghost 2.0 and I am trying to figure out how to solve below problem.

What I am trying to accomplish: I want to be able to show a custom home page in the root URL. For my use case this page needs to be one of the static pages that I can modify from ghost editor. I have already setup the blog posts to show up in the /blog route.

You’ll want to check out the Dynamic Routing documentation for details on how to do that

https://docs.ghost.org/docs/dynamic-routing

1 Like

John, thank you for the quick response.

This is what my routes.yaml looks like.

routes:
  /:
    data: page.home # I have a page named home
    template:
      - home

collections:
  /blog/:
    permalink: /blog/{slug}/
    template:
      - index

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

And in my home.hbs, I am doing:

<main>
{{content}}
</main>

But this outputs undefined.

Solved.

I was able to do ghost run and see the output of my page context in the console using {{log page}} added to index.hbs. This object does not have a key called content that’s why it was outputting undefined earlier. I fixed this issue by using {{{page.html}}}. Notice the triple mustache to render unescaped HTML.

3 Likes

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