What's the difference between a Ghost post and a Ghost page?

When should you use which?

A ghost holding a notebook, ready to write some posts... or pages... or something.

Ghost has both posts and pages. They pretty much look the same in the editor, and in fact, you can use the same template for both. So what's the difference?

Posts

  • Are available in search results (in Ghost's native sodo-search)
  • Can be put into collections, which lets you automatically change the url of all posts with a particular tag or author and collect that collection on an index page. (A URL like /subject/mypost is easy to create for all posts with the tag "subject".)
  • Do not have the "hide header and title" slider, but if you can edit your theme, you can replicate this behavior by making a custom template that omits these items. (You could also use code injection.)
  • The vast majority of themes show a list of (recent) posts on the homepage, tag page, and author page. This automatic behavior is convenient, and "good enough" for many users.
  • For those of you editing your themes, posts are styled by post.hbs by default. If you'd like additional style choices, copying post.hbs to make custom-style-name.hbs and restarting Ghost will get you a second template option.

Pages

  • Do not appear in default search results (unless you switch to an Algolia integration or similar). Good or bad? You decide.
  • Cannot be put into collections. (If you want /folder/mypage, you'll have to create each URL as a route.)
  • Have a "hide featured image and title" slider. Themes are supposed to check the slider value for pages, and hide these elements accordingly. Older themes that don't do this can still be used, but the slider won't do anything.
  • Cannot be created or edited by authors/contributors, only editors/administrators.
  • The vast majority of themes do not show pages anywhere automatically. Not on the homepage. Not on the tag pages. Not on the author pages. You'll need to create links to them, for example, using your site's navigation links. (Nothing prevents a theme from displaying a directory of pages, but I'm not aware of any that do.)
  • Pages are styled by page.hbs by default. If a theme has no page.hbs, then Ghost falls back to post.hbs.

OK, so should I use a page or a post?

One-off items that you don't want on your main blog feed should probably be pages, unless you want them to show up in the search results. But if you have a bunch of some type of content, those probably make more sense as posts, so that you can take advantage of collections. For example, let's say you have a blog with posts, but you also have a collection of resource articles for your readers, spread across multiple URLs. In that case, you'll probably want both content types to be posts, and to use some routing to control what shows up where. So you'd tag your resources as 'resources', and then you'd use a routes file like:

routes:

collections:
  /:
    permalink: /blog/{slug}/
    template: index
    filter: tags:-[resources]
    order: published_at desc

  /resources/:
    permalink: /resources/{slug}/
    template: resources
    filter: tags:[resources]
    order: published_at desc

taxonomies:
  tag: /topic/{slug}/
  author: /author/{slug}/

routes.yaml

This causes /blog/ to have a list of non-resources, and /resources/ to have a list of resources. Specifying the template lets me style those index pages differently, too. (Copy index.hbs and tweak it to create a resources.hbs, if you're using my example.)

For many themes, that's all you'll need.

Why doesn't routes.yaml work on the Ghost official Source theme? Why is everything showing up on the homepage?

Some themes (including Source) make a separate #get request on the homepage to populate parts of the Magazine and Highlight layouts. Unfortunately, #get requests don't know anything about routing. In that case, what you'll need to do instead is find the #get request responsible for fetching posts, and stop it from getting the unwanted posts. https://github.com/TryGhost/Source/blob/main/partials/components/post-list.hbs is going to be a good place to start, but it's going to take some untangling of the logic to create the desired behavior. It may be more expedient to choose a different theme, especially if you aren't comfortable editing handlebars.

(In love with Source but need theme edits to make routing work? Hit me up. I'd be glad to be paid to do the work, and glad to open source the edited version, too.)

Another option: Use tags and skip (most of) the routing.

Here's another option. Use tags. Tag those posts 'blog' and 'resource', and display them from /tags/blog and /tags/resource. Then build a custom homepage (actually as a page!) that links to both of those urls, and follow the linked directions to put that custom homepage at /. This has the advantage of letting you have posts tagged as both blog and resource, and can be less confusing to set up and maintain.

Options. Always good to have.


Hey, before you go... If your finances allow you to keep this tea-drinking ghost and the freelancer behind her supplied with our hot beverage of choice, we'd both appreciate it!