Skip to content

Commit

Permalink
Add 404 page
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlaki committed Mar 2, 2024
1 parent 2c962c8 commit 56fc904
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 0 deletions.
1 change: 1 addition & 0 deletions _redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /404.html 404
7 changes: 7 additions & 0 deletions src/404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "Oops! Page not found"
permalink: "/404.html"
layout: "layout/404.html"
---

<p class="lead">It seems that this URL doesn’t exist. Maybe you misspelled it, or it is removed.</p>
23 changes: 23 additions & 0 deletions src/_includes/layout/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends "layout/base.html" %}

{% block content %}
<div class="l-404">
<div class="container">
<div class="l-404__inner">
<img src="/img/not-found.svg" class="l-404__image" alt="">
<div class="l-404__caption">
<h1 class="l-404__title">{{ title }}</h1>
<div class="post-content">
{{ content | safe }}
</div>
<a href="/" class="btn btn--rounded btn--lg btn--primary">Go home</a>
</div>
</div>
</div>
</div>

{% set gettingStartedSettings = {
"classes": "l-getting-started--border-block-start"
} %}
{% include "../partial/getting-started.html" %}
{% endblock %}
31 changes: 31 additions & 0 deletions src/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -3737,6 +3737,37 @@ pre[class*=language-] {
}
}

.l-404 {
border-block-end: 1px solid var(--spruce-base-color-border);
padding-block: var(--spruce-section-gap);
}
.l-404__inner {
display: flex;
flex-direction: column;
gap: 1.5rem;
text-align: center;
}
.l-404__image {
margin-inline: auto;
max-inline-size: 12rem;
}
.l-404__caption {
margin-inline: auto;
max-inline-size: 40rem;
text-align: center;
text-wrap: balance;
}
.l-404__caption > * {
margin-block-end: 0;
margin-block-start: 0;
}
.l-404__caption > * + * {
margin-block-start: 1.5rem;
}
.l-404__title {
font-size: clamp(2.275rem, 5vw + 1rem, 3.5rem);
}

.btn--rounded {
border-radius: var(--doc-border-radius-md);
}
Expand Down
36 changes: 36 additions & 0 deletions src/img/not-found.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions src/scss/layout/_404.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@use 'sprucecss/scss/spruce' as *;

.l-404 {
border-block-end: 1px solid color('border');
padding-block: get-css-variable(--section-gap);

&__inner {
display: flex;
flex-direction: column;
gap: spacer('m');
text-align: center;
}

&__image {
margin-inline: auto;
max-inline-size: 12rem;
}

&__caption {
@include layout-stack('m');
margin-inline: auto;
max-inline-size: 40rem;
text-align: center;
text-wrap: balance;
}

&__title {
font-size: responsive-font-size(3.5rem, 35, '5vw + 1rem');
}
}
1 change: 1 addition & 0 deletions src/scss/layout/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
@forward 'template';
@forward 'color';
@forward 'templates';
@forward '404';

0 comments on commit 56fc904

Please sign in to comment.