LoveIt/layouts/partials/comment.html

115 lines
4.9 KiB
HTML
Raw Normal View History

{{- if .Scratch.Get "production" | and .IsPage | and (ne .Site.Params.comment.enable false) | and (ne .Params.comment false) -}}
2020-02-14 14:09:21 +01:00
{{- $CDN := .Scratch.Get "CDN" -}}
{{- /* Disqus Comment System */ -}}
{{- with .Site.Params.comment.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 */ -}}
{{- if .Site.Params.comment.gitalk.owner -}}
{{- $gitalk := .Site.Params.comment.gitalk -}}
2020-02-14 17:38:15 +01:00
<div id="gitalk"></div>
2020-02-16 19:32:52 +01:00
{{- with $CDN.gitalkCSS -}}
2020-02-14 14:09:21 +01:00
{{- 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-16 19:32:52 +01:00
{{- with $CDN.gitalkJS -}}
2020-02-14 14:09:21 +01:00
{{- 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: '{{ $gitalk.clientId }}',
clientSecret: '{{ $gitalk.clientSecret }}',
repo: '{{ $gitalk.repo }}',
owner: '{{ $gitalk.owner }}',
admin: ['{{ $gitalk.owner }}'],
2020-02-14 14:09:21 +01:00
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 */ -}}
{{- if .Site.Params.comment.valine.enable -}}
{{- $valine := .Site.Params.comment.valine -}}
2020-02-14 17:38:15 +01:00
<div id="valine"></div>
{{- slice "css/lib/valine/dark.scss" | .Scratch.Add "linkLocal" -}}
2020-02-16 19:32:52 +01:00
{{- with $CDN.valineJS -}}
2020-02-14 14:09:21 +01:00
{{- 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',
appId: '{{ $valine.appId }}',
appKey: '{{ $valine.appKey }}',
{{- with $valine.placeholder -}}
2020-02-14 14:09:21 +01:00
placeholder: '{{ . }}',
{{- end -}}
{{- if $valine.notify -}}
2020-02-14 14:09:21 +01:00
notify: true,
{{- end -}}
{{- if $valine.verify -}}
2020-02-14 14:09:21 +01:00
verify: true,
{{- end -}}
{{- with $valine.avatar -}}
2020-02-14 14:09:21 +01:00
avatar: '{{ . }}',
{{- end -}}
{{- with $valine.meta -}}
2020-02-14 14:09:21 +01:00
meta: {{ . | safeJS }},
{{- end -}}
{{- with $valine.pageSize -}}
2020-02-14 14:09:21 +01:00
pageSize: {{ . | safeJS }},
{{- end -}}
lang: '{{ T "valineLang" }}',
{{- if $valine.visitor -}}
2020-02-14 14:09:21 +01:00
visitor: true,
{{- end -}}
{{- if $valine.recordIP -}}
2020-02-14 14:09:21 +01:00
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 */ -}}
{{- if .Site.Params.comment.facebook.enable -}}
{{- $facebook := .Site.Params.comment.facebook -}}
2020-01-04 03:25:34 +01:00
<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 }}"
data-width="{{ $facebook.width }}"
data-numposts="{{ $facebook.numPosts }}"
2020-01-04 03:25:34 +01:00
></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 $facebook.languageCode $facebook.appId -}}
2020-02-14 14:09:21 +01:00
{{- 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 -}}