Skip to content

Commit b88d13e

Browse files
dholbachzjedi
authored andcommitted
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 <[email protected]>
1 parent ae3f16b commit b88d13e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

exampleSite/hugo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ enableEmoji = true
6363

6464
# Options used for automatic image generation. see: https://gohugo.io/content-management/image-processing/
6565
image_options = "webp q90 lanczos photo"
66+
67+
# Use "page_title | site_title" for <title> tags
68+
# e.g. <title>Legal | Jane Doe - Nutrition Coach & Chef Consultant</title>
69+
combine_page_and_site_title = false
6670

6771
[params.footer]
6872
# Show contact icons for email/phone (if specified) in the footer of the page

layouts/partials/head.html

+4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
22
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
33

4+
{{ if and site.Params.combine_page_and_site_title .Title .Site.Title }}
5+
<title>{{ .Title | plainify }} | {{ .Site.Title | plainify }}</title>
6+
{{ else }}
47
{{ with or .Title .Site.Title | plainify }}
58
<title>{{ . }}</title>
69
{{ end }}
10+
{{ end }}
711

812
{{ with resources.Get .Site.Params.favicon }}
913
<link rel="shortcut icon" href="{{ .RelPermalink }}" type="{{ .MediaType.Type }}" />{{ end }}

0 commit comments

Comments
 (0)