Skip to content

Commit

Permalink
Add combine_page_and_site_title option
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dholbach authored and zjedi committed Oct 6, 2024
1 parent ae3f16b commit b88d13e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions exampleSite/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down

0 comments on commit b88d13e

Please sign in to comment.