On this page
Most Ghost themes use the homepage to list your latest posts. If you want a landing page instead, with an introduction, a few sections and calls to action, you can build it in the Ghost editor as a normal page and tell Ghost to show that page at /. Your posts move to /blog/.
Two ways to get a custom homepage
- A custom template. Write a
home.hbsfile in your theme with your own HTML and CSS. Ghost useshome.hbsfor/automatically. You get full control of the layout, but you need to code, and every change to the homepage is a change to the theme. - A page and
page.hbs. Build the homepage in the editor and render it with the theme’s page template. No theme code, and you can edit it any time like any other page. The layout is limited to what the editor cards and your theme’s page template can do.
This tutorial covers the second way.
What you need
- A theme with a
page.hbstemplate. Most themes have one, and all of ours do. Without it, Ghost usespost.hbs, which also works but shows post details such as the date. - Access to Settings › Advanced › Labs › Beta features in Ghost Admin, to edit
routes.yaml.
1. Create the page
- In Ghost Admin, open Pages and choose New page.
- Give it a title, such as “Home”.
- Open the page settings and set Page URL to
home. It must match the slug you use inroutes.yamlin the next step. - Write the content and publish the page.
Use editor cards to build the sections: images, buttons, call to action, sign-up, product, embeds and more.
2. Point the homepage to the page
In Settings › Advanced › Labs › Beta features, choose Edit in the Routes row. The editor opens your current routes.yaml, so you keep any routes you already have. Change it so that / uses the page, and the post list moves to /blog/:
routes:
/:
template: page
data: page.home
collections:
/blog/:
permalink: /{slug}/
template: index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/What this does:
/is rendered with your theme’spage.hbstemplate.data: page.homeloads the content of the page with the slughome. Ghost also redirects the page’s own URL,/home/, to/, so the content doesn’t exist twice.- The collection now lives at
/blog/, so your list of posts is still there. Withpermalink: /{slug}/the posts keep their current URLs. Usepermalink: /blog/{slug}/if you’d rather have them under/blog/, and redirect the old URLs.
Note
The format is resource.slug: page.home, not home. Ghost rejects a data value without the page. part when you save the file.
3. Save routes.yaml
Choose Save in the editor. If you’d rather edit it in a code editor, use Download file and Upload file from the menu in the Routes row instead. Ghost applies the change straight away, with no restart.
Then add a Blog link to /blog/ in Settings › Site › Navigation, so readers can still find your posts.
The result
Your homepage now shows the page you wrote in the editor, and your posts are at /blog/. To change the homepage, edit the home page and update it: no theme upload, no code.
For more on what routes.yaml can do, read how routing works in Ghost. For other ways to give a page its own layout, see custom pages in Ghost.