The Ghost Themes Developer Hub

Welcome to the Ghost Themes developer hub. You'll find comprehensive guides and documentation to help you start working with Ghost Themes as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    


The private context

Use: {{#is "private"}}{{/is}} to detect this context.

Body Classes







If a blog has password protection enabled, then all users are redirected to a page where they are asked to provide a password. When on this page the context is set to private.


The private context lives at the matching /private/ route. If the user attempted to visit a specific page, the route will look something like /private/?r=%2F and will redirect the user to the url specified in the r query parameter after they enter the correct password. This cannot be customised at present.


By default, the private context will be rendered using the private.hbs file which exists in /private-blogging/lib/views/. This page will be styled to match the Ghost admin panel.

To customise this page, theme developers can provide their own private.hbs file as part of their theme. This will override the default.


The private.hbs gets access to just one piece of data - an error object which may or may not be set after the password form is submitted. If set, error has an attribute of message which contains an explanation of what went wrong with submitting the form.

To conditionally output the message, first check if error is set:

{{#if error}}
  <span class="error-message">{{error.message}}</span>


The private context makes use of a special {{input_password}} helper which outputs a password input with the correct properties, so that the form will work. The private.hbs has a couple of requirements in order to make the form work correctly:

  • It must contain a form which posts back to the same URL
  • The form must have an input with the name password (use the {{input_password}} helper)
  • The page must conditionally output any errors to the user

Example Code

Bare minimum code required for the form to work:

<form method="post">
  <input type="submit" />

{{#if error}}


The private context