comments.html 715 B

12345678910111213141516171819
  1. {{ $provider := trim (site.Params.comments.provider | lower) " " }}
  2. {{ if $provider }}
  3. {{ $provider_tpl := printf "partials/comments/%s.html" $provider }}
  4. {{ $provider_exists := templates.Exists $provider_tpl }}
  5. {{ if not $provider_exists }}
  6. {{ errorf "The '%s' comment provider was not found." $provider }}
  7. {{ end }}
  8. {{ $commentable_page_types := site.Params.comments.commentable | default dict }}
  9. {{ $commentable_page_type := index $commentable_page_types .Type | default false }}
  10. {{ $commentable_page := (ne .Params.commentable false) | and $commentable_page_type }}
  11. {{ if $commentable_page }}
  12. <section id="comments">
  13. {{ partial $provider_tpl . }}
  14. </section>
  15. {{ end }}
  16. {{ end }}