Skip to content

Commit

Permalink
Fix .Site.IsServer error in Hugo >= 0.132.0 [2]
Browse files Browse the repository at this point in the history
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 8b4c646
See #94
  • Loading branch information
Vimux committed Aug 19, 2024
1 parent 8b4c646 commit 8c7a5c0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions layouts/partials/comments.html
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 8c7a5c0

Please sign in to comment.