The flexibility of Ghost means it’s possible to replace your themes' homepage with a published page from your site. You may want to do this so you can customise your homepage without using HTML, CSS, and Handlebars (Ghost’s templating language).
In this tutorial, you’ll learn how to use a page in your Ghost site as your homepage by editing a simple .ymal
file.
- Go to your site's Ghost administration dashboard (for example thomasdowell.co.uk/ghost)
- Note the URL of the published page you want to set as the homepage
- Go to Pages
- Select the published page you want to set as the homepage
- Open the setting panel on the right
- Note the page URL
- Select the settings cog (⚙️) towards the bottom left of the administration dashboard
- Navigate to Advanced >Labs
- Click Open then Download current routes
- Open the downloaded
routes.yaml
file in any text editor. It will look similar to:routes: collections: /: permalink: /{slug}/ template: index taxonomies: tag: /tag/{slug}/ author: /author/{slug}/
- Under
routes:
- Add the following (note the indentenation as per
collections
above), replacing <PageURL> with the page URL you noted in step 2:
For example:/: template: page data: page.\<PageURL>
routes: /: template: page data: page.home
- Back in your site's Ghost administration dashboard, click Upload routes file and select the
routes.yaml
file you've edited and saved - Navigate to your sites domain name (for example thomasdowell.co.uk) and the page will be displayed.