Use native ghost page as home page

I checked official docs and forum, but could not achieve the following:

I want to use a static page with a custom template as home page. So I set up my routes file like this:

routes:
  /:
    data: page.landing
    template: landing

so I created a new page + a template custom-landing.hbs (duplicate of page.hbs). My goal is that page is used as home page

but it only shows blank page. what am I missing?

I am using latest version of ghost.

1 Like

Hi @ureaul! I think you just need to rename your template file to landing.hbs so it matches the template value you’ve set. Here’s a tutorial on setting up custom home pages that has a bit more info on it:

that’s the page I followed.

To my understanding it explains how to set up a custom home page, not a native ghost home page. Am I correct?

Can you tell me what the routes file should look like?

To have a custom home page I would do this:

routes:
  /:
    data: page.home
    template: landing

and create a file called landing.hbs. I’m not sure what you mean by “native”?

thx

I followed your steps and created a landing.hbs (just made a copy of page.hbs for testing purposes)

Yet I get a blank page:
https://indoor-anbau.com

Yet this page should appear: https://indoor-anbau.com/home-3/

You need to update the slug from home-3 to just home

Hey

I just did and it at leasts redirects to /
but the content is stimm empty

That’s a good sign. In your routes file did you set data to page.home? If so then you may not be outputting the content correctly in the template file

Yep, I am still struggling with the template.
I just made a copy of page.hbs and renamed it to home.hbs

That should work, right?

Ah so your routes file should be this then:

routes:
  /:
    data: page.home
    template: home

The template value should match the file name

that’s exactly what I am using right now, but the content is still not displayed

Are you completely sure? Before you were calling it landing and not home?

Hey david

Yes, I double checked the theme and the routes file. Issue persists.

For anyone who arrives here looking for answers:

Aha I got it, turns out the post get code should be page . I thought it was fine as the page.hbs file uses post as well. Here’s the code that should be in home.hbs :

{{!< default}}
{{! The tag above means - insert everything in this file into the {body} of the default.hbs template }}
 <section class="main-content-area">
    <div class="container">
        <div class="row">
            <p>Testing</p>
            {{#page}}
            <div class="col post-single">
                <div class="col-md-8 m-auto post-head">
                   <div class="post-head">
                        <h1 class="post-title">{{title}}</h1>
                    </div>
                </div>
                {{#if feature_image}}
                <div class="featured-image" style="background-image:url({{feature_image}});"></div>
                {{/if}}
                <div class="post-content-wrap col-md-8 m-auto">
                    This is a text in the home.hbs file, the content should appear below
                    {{content}}
                </div>
            </div>
            {{/page}}
        </div>
    </div>
</section>
1 Like