How to set up a 404 page using Pelican

26 September 2014

Pelican supports two types of content: Posts & Pages. Posts are blog posts, while pages are more static pages like 'About me'. For a 404 page, we'll define a new hidden page as follows (I prefer markdown):

Title: 404 Page not found :(
Slug: 404
status: hidden

Sorry, can not find the requested page.

Save this as 404.md inside a folder named 'pages' in the 'content' folder. Note 'status: hidden' - this hides the 404 page from other navigation elements.

If you are using nginx, modify the site config (generally located at /etc/nginx/sites-available/your_cfg) to enable the 404 error page by adding:

error_page 404 /pages/404.html;

That is all!