From fe229d8f2e711df903a275d07bae4f9940d6ee12 Mon Sep 17 00:00:00 2001 From: "max.mehl" Date: Wed, 22 Mar 2017 15:20:18 +0100 Subject: [PATCH] add 404 page and improve relative path translation detection --- config.toml | 6 ++++++ layouts/404.html | 18 ++++++++++++++++++ layouts/partials/404.html | 11 +++++++++++ layouts/partials/head.html | 4 ++-- layouts/partials/language.html | 4 ++-- static/.htaccess | 1 + 6 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 layouts/404.html create mode 100644 layouts/partials/404.html create mode 100644 static/.htaccess diff --git a/config.toml b/config.toml index 960e0da..347d347 100644 --- a/config.toml +++ b/config.toml @@ -96,6 +96,12 @@ DefaultContentLanguage = "en" privacy = "Privacy" transparency = "Transparency" license = "Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved." + +# 404 Error Page +[params.error] + headline = "Error 404 - Page not found" + description = "The page you're looking for does not exist." + button = "Back to start page" # === TRANSLATIONS === diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..c1e583a --- /dev/null +++ b/layouts/404.html @@ -0,0 +1,18 @@ + +{{ $data := index .Site.Data .Site.Language.Lang }} + + + {{ partial "head.html" . }} + + + + + {{ partial "404.html" . }} + + {{ partial "legal.html" . }} + + {{ partial "sharecolumn.html" . }} + + {{ partial "js.html" . }} + + diff --git a/layouts/partials/404.html b/layouts/partials/404.html new file mode 100644 index 0000000..7d5bf79 --- /dev/null +++ b/layouts/partials/404.html @@ -0,0 +1,11 @@ +{{ "" | safeHTML }} +
+
+
+

{{ .Site.Params.error.headline }}

+
+

{{ .Site.Params.error.description }}

+ {{ .Site.Params.error.button }} +
+
+
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 8eacb9c..3b84a74 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -6,9 +6,9 @@ {{ .Hugo.Generator }} {{ .Site.Title }} {{ "" | safeHTML }} - + {{ range .Translations }} - + {{end}} {{ "" | safeHTML }} diff --git a/layouts/partials/language.html b/layouts/partials/language.html index 9625ba7..3bc3932 100644 --- a/layouts/partials/language.html +++ b/layouts/partials/language.html @@ -8,9 +8,9 @@

diff --git a/static/.htaccess b/static/.htaccess new file mode 100644 index 0000000..de377bf --- /dev/null +++ b/static/.htaccess @@ -0,0 +1 @@ +ErrorDocument 404 /404.html