2020-04-21 16:55:06 +02:00
|
|
|
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
|
|
|
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
|
|
|
{{- $comment := (.Scratch.Get "params").comment | default dict -}}
|
|
|
|
{{- $commentConfig := dict -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- if $comment.enable -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
<div id="comments">
|
|
|
|
{{- /* Disqus Comment System */ -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- if $comment.disqus.enable -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
<div id="disqus_thread" class="comment"></div>
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- $source := printf "https://%s.disqus.com/embed.js" $comment.disqus.shortname -}}
|
2020-04-21 19:00:51 +02:00
|
|
|
{{- dict "source" $source "defer" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
<noscript>
|
|
|
|
Please enable JavaScript to view the comments powered by <a href="https://disqus.com/?ref_noscript">Disqus</a>.
|
|
|
|
</noscript>
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- end -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
|
|
|
|
{{- /* Gitalk Comment System */ -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- if $comment.gitalk.enable -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
<div id="gitalk" class="comment"></div>
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- with $cdn.gitalkCSS -}}
|
2020-04-21 19:00:51 +02:00
|
|
|
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- else -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- dict "source" "lib/gitalk/gitalk.css" "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- end -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- with $cdn.gitalkJS -}}
|
2020-04-21 19:00:51 +02:00
|
|
|
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- else -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- dict "source" "lib/gitalk/gitalk.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- end -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- $commentConfig = dict "id" .Date "title" .Title "clientID" $comment.gitalk.clientId "clientSecret" $comment.gitalk.clientSecret "repo" $comment.gitalk.repo "owner" $comment.gitalk.owner "admin" (slice $comment.gitalk.owner) | dict "gitalk" | merge $commentConfig -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
<noscript>
|
|
|
|
Please enable JavaScript to view the comments powered by <a href="https://github.com/gitalk/gitalk"></a>Gitalk</a>.
|
|
|
|
</noscript>
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- end -}}
|
2019-03-15 10:15:32 +01:00
|
|
|
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- /* Valine Comment System */ -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- if $comment.valine.enable -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
<div id="valine" class="comment"></div>
|
|
|
|
{{- $options := dict "targetPath" "lib/valine/valine.min.css" -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- dict "source" "lib/valine/valine.scss" "toCSS" $options | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
|
|
|
{{- with $cdn.valineJS -}}
|
2020-04-21 19:00:51 +02:00
|
|
|
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- else -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- dict "source" "lib/valine/Valine.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- end -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- $commentConfig = dict "el" "#valine" "appId" $comment.valine.appId "appKey" $comment.valine.appKey "lang" ($comment.valine.lang | default (T "valineLang")) "notify" $comment.valine.notify "verify" $comment.valine.verify "visitor" $comment.valine.visitor "recordIP" $comment.valine.recordIP "placeholder" ($comment.valine.placeholder | default (T "valinePlaceholder")) | dict "valine" | merge $commentConfig -}}
|
|
|
|
{{- with $comment.valine.avatar -}}
|
|
|
|
{{- $commentConfig = dict "avatar" . | dict "valine" | merge $commentConfig -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- end -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- with $comment.valine.meta -}}
|
|
|
|
{{- $commentConfig = dict "meta" . | dict "valine" | merge $commentConfig -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- end -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- with $comment.valine.pageSize -}}
|
|
|
|
{{- $commentConfig = dict "pageSize" . | dict "valine" | merge $commentConfig -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- end -}}
|
|
|
|
<noscript>
|
|
|
|
Please enable JavaScript to view the comments powered by <a href="https://valine.js.org/">Valine</a>.
|
|
|
|
</noscript>
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- end -}}
|
2020-01-04 03:25:34 +01:00
|
|
|
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- /* Facebook Comment System */ -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- if $comment.facebook.enable -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
<div id="fb-root" class="comment"></div>
|
|
|
|
<div
|
|
|
|
class="fb-comments"
|
2020-04-21 16:55:06 +02:00
|
|
|
data-href="{{ .Permalink | absURL }}"
|
|
|
|
data-width="{{ $comment.facebook.width }}"
|
|
|
|
data-numposts="{{ $comment.facebook.numPosts }}"
|
2020-04-15 09:46:50 +02:00
|
|
|
></div>
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- $source := printf "https://connect.facebook.net/%s/sdk.js#xfbml=1&version=v5.0&appId=%s&autoLogAppEvents=1" ($comment.facebook.languageCode | default (T "facebookLanguageCode")) $comment.facebook.appId -}}
|
2020-04-21 19:00:51 +02:00
|
|
|
{{- dict "source" $source "defer" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
<noscript>
|
|
|
|
Please enable JavaScript to view the comments powered by <a href="https://developers.facebook.com/docs/plugins/comments/"></a>Facebook</a>.
|
|
|
|
</noscript>
|
|
|
|
{{- end -}}
|
2020-03-17 15:39:25 +01:00
|
|
|
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- /* Telegram Comments System */ -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- if $comment.telegram.enable -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
<div id="telegram-comments" class="comment"></div>
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- $attr := printf `data-comments-app-website="%s"` $comment.telegram.siteID -}}
|
|
|
|
{{- $attr = printf `%s data-limit="%s"` $attr ($comment.telegram.limit | default 5) -}}
|
|
|
|
{{- with $comment.telegram.height -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- $attr = printf `%s data-height="%s"` $attr . -}}
|
|
|
|
{{- end -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- with $comment.telegram.color -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- $attr = printf `%s data-color="%s"` $attr . -}}
|
|
|
|
{{- end -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- if $comment.telegram.colorful -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- $attr = printf `%s data-colorful="1"` $attr -}}
|
|
|
|
{{- end -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- if $comment.telegram.dislikes -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- $attr = printf `%s data-dislikes="1"` $attr -}}
|
|
|
|
{{- end -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- if $comment.telegram.outlined -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- $attr = printf `%s data-outlined="1"` $attr -}}
|
|
|
|
{{- end -}}
|
2020-04-21 19:00:51 +02:00
|
|
|
{{- dict "source" "https://comments.app/js/widget.js?2" "defer" true "attr" $attr | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
<noscript>
|
|
|
|
Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
|
|
|
|
</noscript>
|
|
|
|
{{- end -}}
|
|
|
|
</div>
|
2020-02-06 17:10:00 +01:00
|
|
|
{{- end -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
|
|
|
|
{{- dict "comment" $commentConfig | dict "config" | merge (.Scratch.Get "this") | .Scratch.Set "this" -}}
|