From 6cd835103bd38649770978c2a732f4e995f07336 Mon Sep 17 00:00:00 2001 From: Chen Xianmin Date: Mon, 11 Nov 2024 20:38:16 +0800 Subject: [PATCH] fix: block not work in partial --- layouts/_default/baseof.html | 14 ++++++++++++++ layouts/partials/head/head_meta.html | 12 ------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 34110ddb..884d9a76 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -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 -}} + {{ partial "head.html" . }} diff --git a/layouts/partials/head/head_meta.html b/layouts/partials/head/head_meta.html index ff70eb16..a5480ead 100644 --- a/layouts/partials/head/head_meta.html +++ b/layouts/partials/head/head_meta.html @@ -1,15 +1,3 @@ - - - - {{- block "title" . -}} - {{ if .IsPage }} - {{ .Title }} - {{ .Site.Title }} - {{ else }} - {{ .Site.Title }} - {{ end }} - {{- end -}} - - {{/* Only add hreflang tags if site is multilingual */}} {{ if hugo.IsMultilingual }} {{/* Add translations */}}