LoveIt/layouts/partials/comment.html

112 lines
4.9 KiB
HTML
Raw Normal View History

2020-02-14 14:09:21 +01:00
{{- if .Scratch.Get "production" | and .IsPage | and (ne .Params.comment false) -}}
{{- $CDN := .Scratch.Get "CDN" -}}
{{- /* Disqus Comment System */ -}}
{{- with .Site.Params.disqus.shortname -}}
2019-08-05 15:15:01 +02:00
<div id="disqus_thread"></div>
2020-02-14 14:09:21 +01:00
{{- $script := printf `<script src="https://%s.disqus.com/embed.js"></script>` . -}}
{{- slice $script | $.Scratch.Add "scriptCDN" -}}
<noscript>
Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
</noscript>
2019-08-02 10:16:59 +02:00
{{- end -}}
2019-03-15 10:15:32 +01:00
{{- /* Gitalk Comment System */ -}}
2019-08-02 10:16:59 +02:00
{{- if .Site.Params.gitalk.owner -}}
2020-02-14 17:38:15 +01:00
<div id="gitalk"></div>
2020-02-14 14:09:21 +01:00
{{- with $CDN.gitalk_css -}}
{{- slice . | $.Scratch.Add "linkCDN" -}}
2020-01-31 15:53:04 +01:00
{{- else -}}
2020-02-14 14:09:21 +01:00
{{- slice "css/lib/gitalk/gitalk.css" | .Scratch.Add "linkLocal" -}}
2020-01-31 15:53:04 +01:00
{{- end -}}
2020-02-14 14:09:21 +01:00
{{- with $CDN.gitalk_js -}}
{{- slice . | $.Scratch.Add "scriptCDN" -}}
2020-01-31 15:53:04 +01:00
{{- else -}}
2020-02-14 14:09:21 +01:00
{{- slice "css/lib/gitalk/gitalk.min.js" | .Scratch.Add "scriptLocal" -}}
2020-01-31 15:53:04 +01:00
{{- end -}}
<script>
2020-02-14 14:09:21 +01:00
document.addEventListener("DOMContentLoaded", function(event) {
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),
});
2020-02-14 17:38:15 +01:00
gitalk.render('gitalk');
});
2019-08-02 10:16:59 +02:00
</script>
2020-02-14 14:09:21 +01:00
<noscript>
Please enable JavaScript to view the <a href="https://github.com/gitalk/gitalk">comments powered by Gitalk.</a>
</noscript>
2019-08-05 15:15:01 +02:00
{{- end -}}
2019-03-15 10:15:32 +01:00
{{- /* Valine Comment System */ -}}
2019-08-02 10:16:59 +02:00
{{- if .Site.Params.valine.enable -}}
2020-02-14 17:38:15 +01:00
<div id="valine"></div>
{{- slice "css/lib/valine/dark.scss" | .Scratch.Add "linkLocal" -}}
2020-02-14 14:09:21 +01:00
{{- with $CDN.valine_js -}}
{{- slice . | $.Scratch.Add "scriptCDN" -}}
2020-01-31 15:53:04 +01:00
{{- else -}}
2020-02-14 14:09:21 +01:00
{{- slice "js/lib/valine/Valine.min.js" | .Scratch.Add "scriptLocal" -}}
2020-01-31 15:53:04 +01:00
{{- end -}}
<script>
2020-02-14 14:09:21 +01:00
document.addEventListener("DOMContentLoaded", function(event) {
new Valine({
2020-02-14 17:38:15 +01:00
el: '#valine',
2020-02-14 14:09:21 +01:00
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 -}}
});
});
2019-08-02 10:16:59 +02:00
</script>
2020-02-14 14:09:21 +01:00
<noscript>
Please enable JavaScript to view the <a href="https://valine.js.org/">comments powered by Valine.</a>
</noscript>
2019-08-02 10:16:59 +02:00
{{- end -}}
2020-01-04 03:25:34 +01:00
{{- /* Facebook Comment System */ -}}
2020-01-04 03:25:34 +01:00
{{- if .Site.Params.facebook.enable -}}
<div id="fb-root"></div>
2020-01-30 06:17:42 +01:00
<div
class="fb-comments"
2020-01-04 03:25:34 +01:00
data-href="{{ .Site.Params.baseURL }}{{ .Permalink | absURL }}"
2020-01-30 06:17:42 +01:00
data-width="{{ .Site.Params.facebook.width }}"
2020-01-04 03:25:34 +01:00
data-numposts="{{ .Site.Params.facebook.numPosts }}"
></div>
2020-02-14 14:09:21 +01:00
{{- $script := `<script src="https://connect.facebook.net/%s/sdk.js#xfbml=1&version=v5.0&appId=%s&autoLogAppEvents=1" crossorigin="anonymous"></script>` -}}
{{- $script = printf $script .Site.Params.facebook.languageCode .Site.Params.facebook.appId -}}
{{- slice $script | .Scratch.Add "scriptCDN" -}}
<noscript>
Please enable JavaScript to view the <a href="https://developers.facebook.com/docs/plugins/comments/">comments powered by Facebook.</a>
</noscript>
2020-01-04 03:25:34 +01:00
{{- end -}}
2020-02-06 17:10:00 +01:00
{{- end -}}