diff options
author | Robert Kaussow <mail@geeklabor.de> | 2021-04-22 23:07:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-22 23:07:09 +0300 |
commit | 5eff47c68bc1e1014025f36a7c35bf4cef5a7e73 (patch) | |
tree | bd942a371257794574a3fa220b3df67114d6304d | |
parent | d51f514b90f0b2bcc7fe618f20a9399b84829a7d (diff) |
fix: rework site header for better title and decription handling (#98)v0.11.1
-rw-r--r-- | exampleSite/content/_index.md | 3 | ||||
-rw-r--r-- | exampleSite/content/usage/getting-started.md | 2 | ||||
-rw-r--r-- | layouts/404.html | 6 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 6 | ||||
-rw-r--r-- | layouts/partials/head/favicons.html | 1 | ||||
-rw-r--r-- | layouts/partials/head/meta.html | 12 | ||||
-rw-r--r-- | layouts/partials/head/others.html (renamed from layouts/partials/head.html) | 6 |
7 files changed, 27 insertions, 9 deletions
diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md index 94aad94..05310b0 100644 --- a/exampleSite/content/_index.md +++ b/exampleSite/content/_index.md @@ -1,5 +1,6 @@ --- title: Documentation +description: Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there. --- <!-- markdownlint-capture --> @@ -13,7 +14,7 @@ title: Documentation <!-- markdownlint-restore --> -Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there. You can find a demo and the full documentation at [https://geekdocs.de](https://geekdocs.de). +Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there. ## Features diff --git a/exampleSite/content/usage/getting-started.md b/exampleSite/content/usage/getting-started.md index 140bddc..69b0190 100644 --- a/exampleSite/content/usage/getting-started.md +++ b/exampleSite/content/usage/getting-started.md @@ -5,6 +5,8 @@ weight: -20 This page tells you how to get started with the Geekdoc theme, including installation and basic configuration. +<!--more--> + {{< toc >}} ## Install requirements diff --git a/layouts/404.html b/layouts/404.html index 4d89f62..2c6a928 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -2,7 +2,11 @@ <html lang="{{ .Site.Language.Lang }}"> <head> - {{ partial "head" . }} + {{ partial "head/meta" . }} + <title>Lost? Don't worry</title> + + {{ partial "head/favicons" . }} + {{ partial "head/others" . }} </head> <body> diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 6bcfea2..6c2f781 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -2,7 +2,11 @@ <html lang="{{ .Site.Language.Lang }}"> <head> - {{ partial "head" . }} + {{ partial "head/meta" . }} + <title>{{ if not (eq .Kind "home") }}{{ partial "title" . }} | {{ end }}{{ .Site.Title }}</title> + + {{ partial "head/favicons" . }} + {{ partial "head/others" . }} </head> <body itemscope itemtype="https://schema.org/WebPage"> diff --git a/layouts/partials/head/favicons.html b/layouts/partials/head/favicons.html new file mode 100644 index 0000000..4326806 --- /dev/null +++ b/layouts/partials/head/favicons.html @@ -0,0 +1 @@ +<link rel="icon" href="{{ "favicon/favicon-32x32.png" | relURL }}" type="image/x-icon"> diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html new file mode 100644 index 0000000..f386236 --- /dev/null +++ b/layouts/partials/head/meta.html @@ -0,0 +1,12 @@ +<meta charset="UTF-8"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> + +{{ $description := default (default .Site.Title .Site.Params.description) (default .Summary .Description) }} +{{ $keywords := default .Site.Params.Keywords .Keywords }} + +{{ with $description }} + <meta name="description" content="{{ . }}"> +{{ end }} +{{ with $keywords }} + <meta name="keywords" content="{{ delimit . "," }}"> +{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head/others.html index 9d283a8..2f36fe8 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head/others.html @@ -1,9 +1,3 @@ -<meta charset="UTF-8"> -<meta name="viewport" content="width=device-width, initial-scale=1.0"> -<meta name="description" content="{{ partial "title" . }}"> - -<title>{{ partial "title" . }} | {{ .Site.Title -}}</title> - <link rel="icon" href="{{ "favicon/favicon-32x32.png" | relURL }}" type="image/x-icon"> <link rel="preload" as="font" href="{{ "fonts/Metropolis.woff2" | relURL }}" type="font/woff2" crossorigin="anonymous"> |