Files
HugoBlox-kit/wowchemy/layouts/partials/comments.html
T
Arho Huttunen 3cf9f6cdee fix: comment provider not found (#2165)
Hugo v0.80.0 `Exists` function requires file extension unlike Hugo's Partial statement
2021-02-15 22:41:17 +00:00

20 lines
715 B
HTML

{{ $provider := trim (site.Params.comments.provider | lower) " " }}
{{ if $provider }}
{{ $provider_tpl := printf "partials/comments/%s.html" $provider }}
{{ $provider_exists := templates.Exists $provider_tpl }}
{{ if not $provider_exists }}
{{ errorf "The '%s' comment provider was not found." $provider }}
{{ end }}
{{ $commentable_page_types := site.Params.comments.commentable | default dict }}
{{ $commentable_page_type := index $commentable_page_types .Type | default false }}
{{ $commentable_page := (ne .Params.commentable false) | and $commentable_page_type }}
{{ if $commentable_page }}
<section id="comments">
{{ partial $provider_tpl . }}
</section>
{{ end }}
{{ end }}