Templates and layouts

Design your error pages

An error page is what visitors see when they open an address that doesn't exist, or when your Ghost site has a problem. A new project has no error template, so Ghost shows its own plain error page. Add one to give that page your header, footer and a way back to your posts.

Add an error page

  1. Open your project in Fantasma.
  2. In the left sidebar, click + next to Templates. The Add Template menu opens.
  3. Under Error pages, click the one you want:
    • Error for every error. It alone covers every error, including a missing page.
    • 404 Error for addresses that don't exist, the error visitors meet most.
    • 4xx Error for the other errors numbered 400 to 499, such as a request Ghost refuses.
    • 5xx Error for errors on the server, numbered 500 to 599.

The template appears near the end of the Templates list, in the Error group, and opens on the canvas. When you add more than one, Ghost uses the most exact one. It takes the template for the error's own code first, such as 404 Error, then 4xx Error or 5xx Error, then Error.

Change what it says

A new error page starts with one section, Error Message, which holds a heading, a line of text and a Back to home button. The heading reads "Error {statusCode}" and the line "{message}". The words in curly brackets are data that Ghost fills in on your site, so visitors read "Error 404" and "Page not found", as the canvas shows.

The 404 Error template on the canvas, with Error 404, Page not found and a Back to home button between the header and the footer
Data What visitors see
Status code The error number, such as 404.
Error message Ghost's short description of the error, such as "Page not found".

Click the text on the canvas to edit it. To put the status code or the message into another line, click the Insert data button in the toolbar over the text while you edit it, as Edit text on the canvas describes. Select the Back to home button to change its label or its link. Add more sections below it like on any template.

The header and footer come from the template's layout, the same as on your other pages. To give the error page another layout, select it in the list and choose one under Layout in the right sidebar.

Visitors see the new error page once you publish your theme or upload it again. To check it, open an address on your site that doesn't exist, such as https://example.com/no-such-page/.

To remove an error page, select it and click Delete template at the bottom of the right sidebar. With no error template left, Ghost shows its own error page again.

Was this article helpful?