LoveIt/layouts/partials/comments.html

101 lines
4.5 KiB
HTML

{{- if eq (getenv "HUGO_ENV") "production" | and .IsPage | and (ne .Params.comment false) -}}
{{- /* Disqus Comment System */ -}}
{{- with .Site.Params.disqus.shortname -}}
<div id="disqus_thread"></div>
<script src="https://{{ . }}.disqus.com/embed.js"></script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
{{- end -}}
{{- /* Gitalk Comment System */ -}}
{{- if .Site.Params.gitalk.owner -}}
<div id="gitalk_container"></div>
{{- if .Site.Params.cdn.gitalk_css -}}
{{- .Site.Params.cdn.gitalk_css | safeHTML -}}
{{- else -}}
{{- $res := resources.Get "css/lib/gitalk/gitalk.css" | resources.Minify -}}
<link rel="stylesheet" href="{{ $res.RelPermalink }}">
{{- end -}}
{{- if .Site.Params.cdn.gitalk_js -}}
{{ .Site.Params.cdn.gitalk_js | safeHTML -}}
{{- else -}}
{{- $res := resources.Get "js/lib/gitalk/gitalk.min.js" | resources.Minify -}}
<script src="{{ $res.RelPermalink }}"></script>
{{- end -}}
<script>
var gitalk = new Gitalk({
id: "{{ .Date }}",
title: "{{ .Title }}",
clientID: "{{ .Site.Params.gitalk.clientId }}",
clientSecret: "{{ .Site.Params.gitalk.clientSecret }}",
repo: "{{ .Site.Params.gitalk.repo }}",
owner: "{{ .Site.Params.gitalk.owner }}",
admin: ["{{ .Site.Params.gitalk.owner }}"],
body: decodeURI(location.href)
});
gitalk.render("gitalk_container");
</script>
<noscript>Please enable JavaScript to view the <a href="https://github.com/gitalk/gitalk">comments powered by Gitalk.</a></noscript>
{{- end -}}
{{- /* Valine Comment System */ -}}
{{- if .Site.Params.valine.enable -}}
<div id="valine_container"></div>
{{- if .Site.Params.cdn.valine_js -}}
{{- .Site.Params.cdn.valine_js | safeHTML -}}
{{- else -}}
{{- $res := resources.Get "js/lib/valine/Valine.min.js" | resources.Minify -}}
<script src="{{ $res.RelPermalink }}"></script>
{{- end -}}
<script>
new Valine({
el: "#valine_container",
appId: "{{ .Site.Params.valine.appId }}",
appKey: "{{ .Site.Params.valine.appKey }}",
{{- with .Site.Params.valine.placeholder -}}
placeholder: "{{ . }}",
{{- end -}}
{{- if .Site.Params.valine.notify -}}
notify: true,
{{- end -}}
{{- if .Site.Params.valine.verify -}}
verify: true,
{{- end -}}
{{- with .Site.Params.valine.avatar -}}
avatar: "{{ . }}",
{{- end -}}
{{- with .Site.Params.valine.meta -}}
meta: {{ . | safeJS }},
{{- end -}}
{{- with .Site.Params.valine.pageSize -}}
pageSize: {{ . | safeJS }},
{{- end -}}
lang: {{ T "valineLang" }},
{{- if .Site.Params.valine.visitor -}}
visitor: true,
{{- end -}}
{{- if .Site.Params.valine.recordIP -}}
recordIP: true,
{{- end -}}
});
</script>
<noscript>Please enable JavaScript to view the <a href="https://valine.js.org/">comments powered by Valine.</a></noscript>
{{- end -}}
{{- /* Facebook Comment System */ -}}
{{- if .Site.Params.facebook.enable -}}
<div id="fb-root"></div>
<div
class="fb-comments"
data-href="{{ .Site.Params.baseURL }}{{ .Permalink | absURL }}"
data-width="{{ .Site.Params.facebook.width }}"
data-numposts="{{ .Site.Params.facebook.numPosts }}"
></div>
<script
async
defer
crossorigin="anonymous"
src="https://connect.facebook.net/{{ .Site.Params.facebook.languageCode }}/sdk.js#xfbml=1&version=v5.0&appId={{ .Site.Params.facebook.appId }}&autoLogAppEvents=1"
></script>
<noscript>Please enable JavaScript to view the <a href="https://developers.facebook.com/docs/plugins/comments/">comments powered by Facebook.</a></noscript>
{{- end -}}
{{- end -}}