mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-07 00:15:13 +00:00
Hugo v0.80.0 `Exists` function requires file extension unlike Hugo's Partial statement
20 lines
715 B
HTML
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 }}
|