From fc5680d3df80dda60d0007170641a8d347611297 Mon Sep 17 00:00:00 2001 From: Vimux Date: Mon, 19 Aug 2024 09:38:09 -0400 Subject: [PATCH] Fix .Site.IsServer error in Hugo >= 0.132.0 [2] (#97) The second part of the fix, fixes the comments.html. The `.Site.IsServer` no longer works since Hugo v0.132.0. Use `hugo.IsServer` since Hugo v0.120.0. Related 8b4c646cb0b168ce7fb0dcc3b5cc4ffe81a639a8 See #94 --- layouts/partials/comments.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index 7e065ec..bf068f0 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -1,5 +1,11 @@ -{{ if and (.Site.Config.Services.Disqus.Shortname) (.Param "comments") (not .Site.IsServer) }} +{{- $server := "" }} +{{- if ge (int (index (split hugo.Version ".") 1)) "120" }} + {{- $server = hugo.IsServer }} +{{- else }} + {{- $server = .Site.IsServer }} +{{- end }} +{{- if and (.Site.Config.Services.Disqus.Shortname) (.Param "comments") (not $server) }}
{{ template "_internal/disqus.html" . }}
-{{ end }} \ No newline at end of file +{{- end }} \ No newline at end of file