Skip to content

Commit

Permalink
feat(website): 404 page (#141)
Browse files Browse the repository at this point in the history
* feat(website): 404 page
* style(website): eats leading and trailing whitespace in title tags
  • Loading branch information
trilowy committed Mar 18, 2024
1 parent 3adf90c commit 0aa3bc4
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 4 deletions.
6 changes: 6 additions & 0 deletions www/assets/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ html {
background-color: var(--bg-root);
}

.quack {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='1em' font-size='5rem'>🦆</text></svg>");
background-repeat: repeat;
background-size: 10rem;
}

body {
display: flex;
flex-direction: column;
Expand Down
15 changes: 15 additions & 0 deletions www/layouts/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{ define "headtitle" -}}
{{ printf "%s | %s" "404" site.Title }}
{{- end }}

{{ define "title" }}Il semblerait qu’il y ait un quack… 🦆{{ end }}

{{ define "main" }}
<p>
La page n’existe pas, mais vous pouvez retourner à <a href="{{ "" | relURL }}">l’accueil</a>.
</p>

<script>
document.documentElement.classList.add("quack");
</script>
{{ end }}
23 changes: 22 additions & 1 deletion www/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
<!DOCTYPE html>
<html lang="{{ or site.Language.LanguageCode site.Language.Lang }}" dir="{{ or site.Language.LanguageDirection `ltr` }}">
<html lang="{{ or site.Language.LanguageCode site.Language.Lang }}"
dir="{{ or site.Language.LanguageDirection `ltr` }}">

<head>
<title>
{{- block "headtitle" . -}}
{{- if .IsHome -}}
{{ site.Title }}
{{- else -}}
{{ printf "%s | %s" .Title site.Title }}
{{- end -}}
{{- end -}}
</title>

{{ partial "head.html" . }}
</head>

<body>
<header>
{{ partial "header.html" . }}
<h1>
{{- block "title" . -}}
{{ .Title }}
{{- end -}}
</h1>
</header>

<main>
{{ block "main" . }}{{ end }}
</main>

<footer>
{{ partial "footer.html" . }}
</footer>
</body>

</html>
1 change: 0 additions & 1 deletion www/layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
<meta name="description" content="{{ .Site.Params.description }}">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#1a1a1f" />
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f8f8f8" />
Expand Down
2 changes: 0 additions & 2 deletions www/layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@
</nav>

{{ partial "menu.html" (dict "menuID" "main" "page" .) }}

<h1>{{ .Title }}</h1>

0 comments on commit 0aa3bc4

Please sign in to comment.