Skip to main content

This is a draft (version 0.5.0). The National Information Technology Agency (NITA) plans to make GGDS official guidance for government websites after independent accessibility testing. What this means

Ghana Government Design System Design system for Government of Ghana websites – home Search

Pattern

Page not found and other errors

Error pages that say what went wrong in plain words, do not blame the reader, and give a way to carry on.

When to use

  • When a page does not exist or has moved: "Page not found".
  • When a service is closed on purpose, for maintenance or outside its hours: "Service unavailable".
  • When something goes wrong on your side: "Sorry, there is a problem with the service".

How it works

  1. The heading says what happened in plain words. Not "404", "Error 500" or "Oops!".
  2. A short explanation of what people can do: check the address, try again later, or use another way.
  3. A way to carry on: a search box, a link to the homepage, and the most likely pages.
  4. A way to get help, such as a phone number, when people cannot finish something important.

Writing error pages

  • Do not blame people. "If you typed the web address, check it is correct", not "You entered an invalid address".
  • Do not show technical details: error codes, stack traces, server names. They mean nothing to most people and help attackers. Log them instead.
  • When a service is unavailable, say when it will be back, with a day and time. Say whether people will lose what they entered.
  • Say whether a deadline will be moved if the service was down near it.
  • Keep error pages small. They should load quickly on a slow connection, and should not depend on the part of the website that has failed.
  • Keep your usual header and footer, so people know they are still on your website.

Status codes

The words are for people. The status code is for browsers and search engines, and must still be correct.

  • Send 404 for "Page not found", or 410 when a page has been removed for good. Never send 200 with a "not found" page: search engines will keep listing it.
  • Send 503 for "Service unavailable", with a Retry-After header when you know when it will be back.
  • Send 500 for "Sorry, there is a problem with the service".
  • When a page moves, send a permanent redirect (301) from the old address to the new one, so links in SMS messages, letters and posters keep working. Do not send every missing page to the homepage.
  • With Django, add 404.html and 500.html templates that use your GGDS page layout. Django shows them when DEBUG is off. Keep 500.html simple: it is shown when something has already gone wrong, without the usual template context.

Accessibility

  • Start the page title with the heading, such as "Page not found – Example Agency", so screen reader users hear what happened first.
  • Give the search box a label, as on any other page.
  • Check your "Page not found" reports regularly. Fix broken links on your own website, and add redirects for addresses people often get wrong.

Example: Page not found

Open this example on its own page

HTML code for “Page not found”
HTML
<div class="ggds-measure">
<h1>Page not found</h1>
<p>If you typed the web address, check it is correct.</p>
<p>If you followed a link or pasted the address, the page may have moved or been removed.</p>
<form action="/search/" method="get" role="search">
  <div class="ggds-field">
    <label class="ggds-label" for="notfound-q">Search this website</label>
    <input class="ggds-input ggds-input--width-long" id="notfound-q" name="q" type="search" enterkeyhint="search">
  </div>
  <button class="ggds-button" type="submit">Search</button>
</form>
<p>Or go to:</p>
<ul>
  <li><a href="/">the homepage</a></li>
  <li><a href="/services/">all our services</a></li>
  <li><a href="/contact/">contact us</a></li>
</ul>
</div>
JSX (React)
<div className="ggds-measure">
<h1>Page not found</h1>
<p>If you typed the web address, check it is correct.</p>
<p>If you followed a link or pasted the address, the page may have moved or been removed.</p>
<form action="/search/" method="get" role="search">
  <div className="ggds-field">
    <label className="ggds-label" htmlFor="notfound-q">Search this website</label>
    <input className="ggds-input ggds-input--width-long" id="notfound-q" name="q" type="search" enterKeyHint="search" />
  </div>
  <button className="ggds-button" type="submit">Search</button>
</form>
<p>Or go to:</p>
<ul>
  <li><a href="/">the homepage</a></li>
  <li><a href="/services/">all our services</a></li>
  <li><a href="/contact/">contact us</a></li>
</ul>
</div>

Example: Service unavailable

Open this example on its own page

HTML code for “Service unavailable”
HTML
<div class="ggds-measure">
<h1>Sorry, this service is unavailable</h1>
<p>You will be able to apply for a licence online again from 6am on Saturday 14 November 2026.</p>
<p>We are making changes to the service. Applications you have already sent are safe.</p>
<p>If your licence runs out before then, it stays valid until 21 November 2026.</p>
<p>If you need help now, call us on <a href="tel:+233300000000">030 000 0000</a>, Monday to Friday, 8am to 5pm.</p>
</div>
JSX (React)
<div className="ggds-measure">
<h1>Sorry, this service is unavailable</h1>
<p>You will be able to apply for a licence online again from 6am on Saturday 14 November 2026.</p>
<p>We are making changes to the service. Applications you have already sent are safe.</p>
<p>If your licence runs out before then, it stays valid until 21 November 2026.</p>
<p>If you need help now, call us on <a href="tel:+233300000000">030 000 0000</a>, Monday to Friday, 8am to 5pm.</p>
</div>

Example: A problem with the service

Open this example on its own page

HTML code for “A problem with the service”
HTML
<div class="ggds-measure">
<h1>Sorry, there is a problem with the service</h1>
<p>Try again later.</p>
<p>We saved your answers. When the service is working, you can carry on from where you stopped.</p>
<p>If you were paying by mobile money, check your messages before you try again, so you do not pay twice.</p>
<p><a href="/contact/">Contact us</a> if you keep seeing this page.</p>
</div>
JSX (React)
<div className="ggds-measure">
<h1>Sorry, there is a problem with the service</h1>
<p>Try again later.</p>
<p>We saved your answers. When the service is working, you can carry on from where you stopped.</p>
<p>If you were paying by mobile money, check your messages before you try again, so you do not pay twice.</p>
<p><a href="/contact/">Contact us</a> if you keep seeing this page.</p>
</div>

Components used

Back to top

Something wrong, unclear or missing? Report a problem with this page or suggest a change to it on GitHub. You need a GitHub account.