Skip to content

Commit

Permalink
fix: <title> block not work in partial
Browse files Browse the repository at this point in the history
  • Loading branch information
xianmin committed Nov 11, 2024
1 parent 6e237ed commit 6cd8351
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
14 changes: 14 additions & 0 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
<html lang="{{ $.Site.LanguageCode | default `en` }}" itemscope itemtype="http://schema.org/WebPage" data-theme="light">

<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
{{/* block not work in partials
see: https://github.com/gohugoio/hugo/issues/7936
*/}}
{{- block "title" . -}}
{{ if .IsPage }}
{{ .Title }} - {{ .Site.Title }}
{{ else }}
{{ .Site.Title }}
{{ end }}
{{- end -}}
</title>
{{ partial "head.html" . }}
</head>

Expand Down
12 changes: 0 additions & 12 deletions layouts/partials/head/head_meta.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
{{- block "title" . -}}
{{ if .IsPage }}
{{ .Title }} - {{ .Site.Title }}
{{ else }}
{{ .Site.Title }}
{{ end }}
{{- end -}}
</title>

{{/* Only add hreflang tags if site is multilingual */}}
{{ if hugo.IsMultilingual }}
{{/* Add translations */}}
Expand Down

0 comments on commit 6cd8351

Please sign in to comment.