Have a Static Home Page with Ghost


Post cover image

With dynamic routing, you can now specify a dedicated home page with your posts living elsewhere. Here is how you can do that:

So, in order to do this, we need to create a new dymanic route that tells Ghost there is a static home page and then create a template for that home page.

  1. Log into your Ghost admin and click on 'Labs'

  2. Scroll to the bottom and click on 'Download current routes.yml'

    home2

  3. Open this file in Notepad or TextEdit or whatever you want.

  4. It should look like this:

    home1

  5. Change your routes.yaml to look like the following:

    routes:
      /:
        controller: channel
        template: 
          - home
    
    collections:
      /blog/:
        permalink: /blog/{slug}/
        template: 
          - index
    
    taxonomies:
      tag: /tag/{slug}/
      author: /author/{slug}/
    

    home3

  6. Save this file and upload it in the Ghost admin where it says 'Upload routes YAML'.

  7. Now you create a home.hbs file (typically you can just duplicate your index.hbs and then change to whatever you want!) in your theme, and what is in this file will show up at the [yoururl].com and the index.hbs and all of your posts will show up at the [yoururl].com/blog.

There is so much more that Ghost's dynamic routing can do, but this works great to have a set home page. We will be getting further into the customization that it provides in other posts.