Handling errors and 404s

At some point a user will inevitably request a page that doesn’t exist.

###CMS page 404 To gracefully handle these routing errors and/or 404s, you will need to create a 404.liquid file in your pages directory.

You can add custom 404 messages to these themes using the 404 content chunk that you can edit in the backend.

{% content_block custom_404_text %}
    {% if content_block_found %}
        {{content_block}}
    {% else %}
        <p>Sorry, but we couldn't find the page you were looking for...</p>
        <p>To return to the home page, <a href="/">click here</a></p>
    {% endif %}
{% endcontent_block %}

###General routing 404s The same thing can be applied to general routing 404s on the site. To customize the template you simply need to create a ‘/errors/routing.liquid’ file in the theme.