Ghost Static Front Pages with Channels

The new way to do this is with the routes.yaml file. What you want is the following config:

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

You'll then need to create and upload a home.hbs file with your homepage, and all shall be excellent.

For before v2

This is entirely undocumented functionality. It works as of v1.20.3, and possibly earlier. As such, this post only explains enough that you can implement it if you know what you're doing.

If you want to set up Ghost as a more traditional CMS with a static front page, you can now use the built-in channels feature to do so.

Firstly, create a home.hbs template in your template folder. This will give you your static front page. So far so normal, but until now you haven't been able to have a blog area that works with pagination. This is now solved.

Create config.channels.json in the root of your Ghost install. Then add the following to it:

{
  "index": {
    "route": "/",
    "frontPageTemplate": "home"
  },
  "blog": {
    "route": "/blog/",
    "slugTemplate": true
  },
  "tag": {
    "route": "/:t_tag/:slug/",
    "postOptions": {
      "filter": "tags:'%s'+tags.visibility:public"
    },
    "data": {
      "tag": {
        "type": "read",
        "resource": "tags",
        "options": {
          "slug": "%s",
          "visibility": "public"
        }
      }
    },
    "slugTemplate": true,
    "editRedirect": "#/settings/tags/:slug/"
  },
  "author": {
    "route": "/:t_author/:slug/",
    "postOptions": {
      "filter": "author:'%s'"
    },
    "data": {
      "author": {
        "type": "read",
        "resource": "users",
        "options": {
          "slug": "%s"
        }
      }
    },
    "slugTemplate": true,
    "editRedirect": "#/team/:slug/"
  }
}

The important bit is:

"blog": {
  "route": "/blog/",
  "slugTemplate": true
},

This sets up the route /blog/ in your site, which will use your existing index.hbs file to generate a normal list of every blog post for your site.

If you've enjoyed this post, you might want to follow our founder, Pete Watson-Wailes on Twitter