add 404 page and improve relative path translation detection

lektura
max.mehl 2017-03-22 15:20:18 +01:00
parent d5a3f36187
commit fe229d8f2e
6 changed files with 40 additions and 4 deletions

View File

@ -97,6 +97,12 @@ DefaultContentLanguage = "en"
transparency = "Transparency" transparency = "Transparency"
license = "Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved." 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 === # === TRANSLATIONS ===
[Languages] [Languages]

18
layouts/404.html 100644
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
{{ $data := index .Site.Data .Site.Language.Lang }}
<html lang="en-US">
<head>
{{ partial "head.html" . }}
</head>
<body id="page-top">
<!--{{ partial "nav.html" . }}-->
{{ partial "404.html" . }}
{{ partial "legal.html" . }}
{{ partial "sharecolumn.html" . }}
{{ partial "js.html" . }}
</body>
</html>

View File

@ -0,0 +1,11 @@
{{ "<!-- 404 HEADER -->" | safeHTML }}
<header>
<div class="header-content">
<div class="header-content-inner">
<h1>{{ .Site.Params.error.headline }}</h1>
<hr>
<p>{{ .Site.Params.error.description }}</p>
<a href="/" class="btn btn-primary btn-xl page-scroll">{{ .Site.Params.error.button }}</a>
</div>
</div>
</header>

View File

@ -6,9 +6,9 @@
{{ .Hugo.Generator }} {{ .Hugo.Generator }}
<title>{{ .Site.Title }}</title> <title>{{ .Site.Title }}</title>
{{ "<!-- Translations -->" | safeHTML }} {{ "<!-- Translations -->" | safeHTML }}
<link type="text/html" rel="alternate" hreflang="{{ .Lang }}" lang="{{ .Lang }}" href="{{ if eq .Lang "en" }}/{{else}}/{{ .Lang }}/{{end}}" title="{{ .Site.Params.languageName }}"> <link type="text/html" rel="alternate" hreflang="{{ .Lang }}" lang="{{ .Lang }}" href="{{ .RelPermalink }}" title="{{ .Site.Params.languageName }}">
{{ range .Translations }} {{ range .Translations }}
<link type="text/html" rel="alternate" hreflang="{{ .Lang }}" lang="{{ .Lang }}" href="{{ if eq .Lang "en" }}/{{else}}/{{ .Lang }}/{{end}}" title="{{ .Site.Params.languageName }}"> <link type="text/html" rel="alternate" hreflang="{{ .Lang }}" lang="{{ .Lang }}" href="{{ .RelPermalink }}" title="{{ .Site.Params.languageName }}">
{{end}} {{end}}
{{ "<!-- Favicon -->" | safeHTML }} {{ "<!-- Favicon -->" | safeHTML }}
<link rel="shortcut icon" href="{{ .Site.Params.favicon | absURL }}"> <link rel="shortcut icon" href="{{ .Site.Params.favicon | absURL }}">

View File

@ -8,9 +8,9 @@
<p style="font-size:25px;"><i class="fa fa-globe" aria-hidden="true" style="font-size:1.5em;vertical-align:top;"></i></p> <p style="font-size:25px;"><i class="fa fa-globe" aria-hidden="true" style="font-size:1.5em;vertical-align:top;"></i></p>
<ul> <ul>
{{ range .Translations }} {{ range .Translations }}
<li><a href="{{ if eq .Lang "en" }}/{{else}}/{{ .Lang }}/{{end}}">{{ .Site.Params.languageName }}</a></li> <li><a href="{{ .RelPermalink }}">{{ .Site.Params.languageName }}</a></li>
{{end}} {{end}}
<li><a href="{{ if eq .Lang "en" }}/{{else}}/{{ .Lang }}/{{end}}">{{ .Site.Params.languageName }}</a></li> <li><a href="{{ .RelPermalink }}">{{ .Site.Params.languageName }}</a></li>
</ul> </ul>
</div> </div>
</div> </div>

1
static/.htaccess 100644
View File

@ -0,0 +1 @@
ErrorDocument 404 /404.html