From 8b4c646cb0b168ce7fb0dcc3b5cc4ffe81a639a8 Mon Sep 17 00:00:00 2001 From: Vimux Date: Thu, 15 Aug 2024 14:29:44 -0400 Subject: [PATCH] Fix .Site.IsServer error in Hugo >= 0.132.0 (#96) The `.Site.IsServer` no longer works since Hugo v0.132.0. Use `hugo.IsServer` since Hugo v0.120.0 Fixes #94 --- layouts/_default/baseof.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 3a058ac..4dbc8b6 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -35,7 +35,13 @@ {{- with ((.Site.GetPage "home").OutputFormats.Get "manifest") }} {{- end }} - {{- if not .Site.IsServer }} + {{- $server := "" }} + {{- if ge (int (index (split hugo.Version ".") 1)) "120" }} + {{- $server = hugo.IsServer }} + {{- else }} + {{- $server = .Site.IsServer }} + {{- end }} + {{- if not $server -}} {{ template "_internal/google_analytics.html" . }} {{- end }}