Add combine_page_and_site_title option

If true, it will e.g. change the title tag for the Legal page to
<title>Legal | Jane Doe - Nutrition Coach & Chef Consultant</title>

Signed-off-by: Daniel Holbach <daniel.holbach@gmail.com>
This commit is contained in:
Daniel Holbach 2024-10-06 12:05:14 +02:00 committed by zjedi
parent ae3f16bd93
commit b88d13e7f0
2 changed files with 8 additions and 0 deletions

View file

@ -63,6 +63,10 @@ enableEmoji = true
# Options used for automatic image generation. see: https://gohugo.io/content-management/image-processing/
image_options = "webp q90 lanczos photo"
# Use "page_title | site_title" for <title> tags
# e.g. <title>Legal | Jane Doe - Nutrition Coach & Chef Consultant</title>
combine_page_and_site_title = false
[params.footer]
# Show contact icons for email/phone (if specified) in the footer of the page

View file

@ -1,9 +1,13 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
{{ if and site.Params.combine_page_and_site_title .Title .Site.Title }}
<title>{{ .Title | plainify }} | {{ .Site.Title | plainify }}</title>
{{ else }}
{{ with or .Title .Site.Title | plainify }}
<title>{{ . }}</title>
{{ end }}
{{ end }}
{{ with resources.Get .Site.Params.favicon }}
<link rel="shortcut icon" href="{{ .RelPermalink }}" type="{{ .MediaType.Type }}" />{{ end }}