404 / Not found template
Render content shown when a visitor hits a URL that does not match any record
The 404 template renders the page for any URL on your site that does not match a record.
Location
The 404 template lives in templates/:
└── theme
├── layouts
├── templates
│ ├── 404.liquid
│ ...Content
Every site has a system-owned page with the slug 404. Basker passes that page into templates/404.liquid as page. Render its blocks with {% stageblocks page %}. Treat page as optional in the template. The object is only in scope when that page exists.
Use the template to tell the visitor that Basker could not find the page they wanted. Also give them useful next steps. For example, add links to popular pages, a search bar, or a link to the home page or events calendar.
<h1 class="title">Page not found</h1>
<p>The page you were looking for doesn't exist. Try one of these instead:</p>
<a href="/concerts-and-events/calendar" class="btn">View calendar</a>
<a href="/" class="btn btn--secondary">Go to home page</a>Combine the template with navigation to show the main entry points of the site. Add smart collections, such as upcoming events, to give the visitor something useful to click.
Related
- Template context: global functions like
navigationandtenant. - Templates: the broader template-writing workflow.