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 8b4c646cb0
See #94
This commit is contained in:
Vimux 2024-08-19 09:38:09 -04:00 committed by GitHub
parent 8b4c646cb0
commit fc5680d3df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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) }}
<section class="comments block">
{{ template "_internal/disqus.html" . }}
</section>
{{ end }}
{{- end }}