From 5eff47c68bc1e1014025f36a7c35bf4cef5a7e73 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Thu, 22 Apr 2021 22:07:09 +0200 Subject: [PATCH] fix: rework site header for better title and decription handling (#98) --- exampleSite/content/_index.md | 3 ++- exampleSite/content/usage/getting-started.md | 2 ++ layouts/404.html | 6 +++++- layouts/_default/baseof.html | 6 +++++- layouts/partials/head/favicons.html | 1 + layouts/partials/head/meta.html | 12 ++++++++++++ layouts/partials/{head.html => head/others.html} | 6 ------ 7 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 layouts/partials/head/favicons.html create mode 100644 layouts/partials/head/meta.html rename layouts/partials/{head.html => head/others.html} (91%) 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. --- @@ -13,7 +14,7 @@ title: Documentation -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. + + {{< 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 @@ - {{ partial "head" . }} + {{ partial "head/meta" . }} + Lost? Don't worry + + {{ partial "head/favicons" . }} + {{ partial "head/others" . }} 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 @@ - {{ partial "head" . }} + {{ partial "head/meta" . }} + {{ if not (eq .Kind "home") }}{{ partial "title" . }} | {{ end }}{{ .Site.Title }} + + {{ partial "head/favicons" . }} + {{ partial "head/others" . }} 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 @@ + 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 @@ + + + +{{ $description := default (default .Site.Title .Site.Params.description) (default .Summary .Description) }} +{{ $keywords := default .Site.Params.Keywords .Keywords }} + +{{ with $description }} + +{{ end }} +{{ with $keywords }} + +{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head/others.html similarity index 91% rename from layouts/partials/head.html rename to layouts/partials/head/others.html index 9d283a8..2f36fe8 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head/others.html @@ -1,9 +1,3 @@ - - - - -{{ partial "title" . }} | {{ .Site.Title -}} -