mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-27 00:56:19 +01:00
113 lines
6.6 KiB
HTML
113 lines
6.6 KiB
HTML
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
|
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
|
{{- $comment := .Scratch.Get "comment" | default (dict "disqus" dict "gitalk" dict "valine" dict "facebook" dict "telegram" dict "commento" dict) -}}
|
|
{{- $commentConfig := dict -}}
|
|
|
|
{{- if $comment.enable -}}
|
|
<div id="comments">
|
|
{{- /* Disqus Comment System */ -}}
|
|
{{- if $comment.disqus.enable -}}
|
|
<div id="disqus_thread" class="comment"></div>
|
|
{{- $source := printf "https://%s.disqus.com/embed.js" $comment.disqus.shortname -}}
|
|
{{- dict "source" $source "defer" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
|
<noscript>
|
|
Please enable JavaScript to view the comments powered by <a href="https://disqus.com/?ref_noscript">Disqus</a>.
|
|
</noscript>
|
|
{{- end -}}
|
|
|
|
{{- /* Gitalk Comment System */ -}}
|
|
{{- if $comment.gitalk.enable -}}
|
|
{{- $gitalk := $comment.gitalk -}}
|
|
<div id="gitalk" class="comment"></div>
|
|
{{- $source := $cdn.gitalkCSS | default "lib/gitalk/gitalk.css" -}}
|
|
{{- dict "source" $source "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
|
{{- $source := $cdn.gitalkJS | default "lib/gitalk/gitalk.min.js" -}}
|
|
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
|
{{- $commentConfig = dict "id" .Date "title" .Title "clientID" $gitalk.clientId "clientSecret" $gitalk.clientSecret "repo" $gitalk.repo "owner" $gitalk.owner "admin" (slice $gitalk.owner) | dict "gitalk" | merge $commentConfig -}}
|
|
<noscript>
|
|
Please enable JavaScript to view the comments powered by <a href="https://github.com/gitalk/gitalk"></a>Gitalk</a>.
|
|
</noscript>
|
|
{{- end -}}
|
|
|
|
{{- /* Valine Comment System */ -}}
|
|
{{- if $comment.valine.enable -}}
|
|
{{- $valine := $comment.valine -}}
|
|
<div id="valine" class="comment"></div>
|
|
{{- $options := dict "targetPath" "lib/valine/valine.min.css" -}}
|
|
{{- dict "source" "lib/valine/valine.scss" "toCSS" $options | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
|
{{- $source := $cdn.valineJS | default "lib/valine/Valine.min.js" -}}
|
|
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
|
{{- $commentConfig = dict "el" "#valine" "appId" $valine.appId "appKey" $valine.appKey "lang" ($valine.lang | default (T "valineLang")) "visitor" $valine.visitor "recordIP" $valine.recordIP "placeholder" ($valine.placeholder | default (T "valinePlaceholder")) "highlight" (ne $valine.highlight false) "enableQQ" $valine.enableQQ | dict "valine" | merge $commentConfig -}}
|
|
{{- with $valine.avatar -}}
|
|
{{- $commentConfig = dict "avatar" . | dict "valine" | merge $commentConfig -}}
|
|
{{- end -}}
|
|
{{- with $valine.meta -}}
|
|
{{- $commentConfig = dict "meta" . | dict "valine" | merge $commentConfig -}}
|
|
{{- end -}}
|
|
{{- with $valine.pageSize -}}
|
|
{{- $commentConfig = dict "pageSize" . | dict "valine" | merge $commentConfig -}}
|
|
{{- end -}}
|
|
{{- with $valine.serverURLs -}}
|
|
{{- $commentConfig = dict "serverURLs" . | dict "valine" | merge $commentConfig -}}
|
|
{{- end -}}
|
|
<noscript>
|
|
Please enable JavaScript to view the comments powered by <a href="https://valine.js.org/">Valine</a>.
|
|
</noscript>
|
|
{{- end -}}
|
|
|
|
{{- /* Facebook Comment System */ -}}
|
|
{{- if $comment.facebook.enable -}}
|
|
{{- $facebook := $comment.facebook -}}
|
|
<div id="fb-root" class="comment"></div>
|
|
<div
|
|
class="fb-comments"
|
|
data-href="{{ .Permalink }}"
|
|
data-width="{{ $facebook.width }}"
|
|
data-numposts="{{ $facebook.numPosts }}"
|
|
></div>
|
|
{{- $source := printf "https://connect.facebook.net/%s/sdk.js#xfbml=1&version=v5.0&appId=%s&autoLogAppEvents=1" ($facebook.languageCode | default (T "facebookLanguageCode")) $facebook.appId -}}
|
|
{{- dict "source" $source "defer" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
|
<noscript>
|
|
Please enable JavaScript to view the comments powered by <a href="https://developers.facebook.com/docs/plugins/comments/"></a>Facebook</a>.
|
|
</noscript>
|
|
{{- end -}}
|
|
|
|
{{- /* Telegram Comments System */ -}}
|
|
{{- if $comment.telegram.enable -}}
|
|
{{- $telegram := $comment.telegram -}}
|
|
<div id="telegram-comments" class="comment"></div>
|
|
{{- $attr := printf `data-comments-app-website="%s"` $telegram.siteID -}}
|
|
{{- $attr = printf `%s data-limit="%s"` $attr ($telegram.limit | default 5) -}}
|
|
{{- with $telegram.height -}}
|
|
{{- $attr = printf `%s data-height="%s"` $attr . -}}
|
|
{{- end -}}
|
|
{{- with $telegram.color -}}
|
|
{{- $attr = printf `%s data-color="%s"` $attr . -}}
|
|
{{- end -}}
|
|
{{- if $telegram.colorful -}}
|
|
{{- $attr = printf `%s data-colorful="1"` $attr -}}
|
|
{{- end -}}
|
|
{{- if $telegram.dislikes -}}
|
|
{{- $attr = printf `%s data-dislikes="1"` $attr -}}
|
|
{{- end -}}
|
|
{{- if $telegram.outlined -}}
|
|
{{- $attr = printf `%s data-outlined="1"` $attr -}}
|
|
{{- end -}}
|
|
{{- dict "source" "https://comments.app/js/widget.js?2" "defer" true "attr" $attr | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
|
<noscript>
|
|
Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
|
|
</noscript>
|
|
{{- end -}}
|
|
|
|
{{- /* Commento Comment System */ -}}
|
|
{{- if $comment.commento.enable -}}
|
|
<div id="commento"></div>
|
|
{{- dict "source" "https://cdn.commento.io/js/commento.js" "defer" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
|
|
<noscript>
|
|
Please enable JavaScript to view the comments powered by <a href="https://commento.io/">Commento</a>.
|
|
</noscript>
|
|
{{- end -}}
|
|
</div>
|
|
{{- end -}}
|
|
|
|
{{- dict "comment" $commentConfig | dict "config" | merge (.Scratch.Get "this") | .Scratch.Set "this" -}}
|