🎨 Added specific 404 template & simplified fallback (#348)

no issue

- The 404 Error template can have a little more fancy logic than other templates
- Therefore, we make the 404 template have the get helper
- The fallback general error template has no use of the get helper
- This helps ensure that errors can be rendered
This commit is contained in:
Hannah Wolfe 2017-08-10 14:34:23 +01:00 committed by John O'Nolan
parent 10f11bb14f
commit d7ca6fd2f6
2 changed files with 59 additions and 14 deletions

56
error-404.hbs Normal file
View File

@ -0,0 +1,56 @@
{{!--
This error template is used for all 404 errors, which might occur on your site.
It's a good idea to keep this template as minimal as possible in terms of both file size and complexity.
--}}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>{{meta_title}}</title>
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="{{asset "built/screen.css"}}" />
</head>
<body class="error-template">
<div class="site-wrapper">
<header class="site-header outer {{#if feature_image}}" style="background-image: url({{feature_image}}){{else}}no-cover{{/if}}">
<div class="inner">
<nav class="site-nav-center">
{{#if @blog.logo}}
<a class="site-nav-logo" href="{{@blog.url}}"><img src="{{@blog.logo}}" alt="{{@blog.title}}" /></a>
{{else}}
<a class="site-nav-logo" href="{{@blog.url}}">{{@blog.title}}</a>
{{/if}}
</nav>
</div>
</header>
<main id="site-main" class="site-main outer" role="main">
<div class="inner">
<section class="error-message">
<h1 class="error-code">{{code}}</h1>
<p class="error-description">{{message}}</p>
<a class="error-link" href="{{@blog.url}}">Go to the front page →</a>
</section>
</div>
</main>
{{#get "posts" limit="3"}}
<aside class="outer">
<div class="inner">
<div class="post-feed">
{{#foreach posts}}
{{> "post-card"}}
{{/foreach}}
</div>
</div>
</aside>
{{/get}}
</div>
</body>
</html>

View File

@ -1,5 +1,7 @@
{{!--
This error template is used for all 400/500 errors which might occur on your site. It's a good idea to keep this template as minimal as possible in terms of both file size and complexity. You'll notice that we *don't* use any JavsScript, or ghost_head / ghost_foot in this file.
This error template is used for all 400/500 errors, except 404, which might occur on your site.
It's a good idea to keep this template as minimal as possible in terms of both file size and complexity.
You'll notice that we *don't* use any JavsScript, or ghost_head / ghost_foot in this file.
--}}
<!DOCTYPE html>
@ -56,19 +58,6 @@ This error template is used for all 400/500 errors which might occur on your sit
</div>
</main>
{{#get "posts" limit="3"}}
<aside class="outer">
<div class="inner">
<div class="post-feed">
{{#foreach posts}}
{{> "post-card"}}
{{/foreach}}
</div>
</div>
</aside>
{{/get}}
</div>
</body>
</html>