fix(compatibility): compatibility for version 0.1.X (#351)

This commit is contained in:
Dillon
2020-05-12 22:40:49 +08:00
committed by GitHub
parent 7d0603ece0
commit 7c4962e39a
4 changed files with 39 additions and 19 deletions

View File

@@ -1,14 +1,15 @@
{{- $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 "utterances" dict) -}}
{{- $comment := .Scratch.Get "comment" | default dict -}}
{{- $commentConfig := dict -}}
{{- if $comment.enable -}}
<div id="comments">
{{- /* Disqus Comment System */ -}}
{{- if $comment.disqus.enable -}}
{{- $disqus := $comment.disqus | default dict -}}
{{- if $disqus.enable -}}
<div id="disqus_thread" class="comment"></div>
{{- $source := printf "https://%s.disqus.com/embed.js" $comment.disqus.shortname -}}
{{- $source := printf "https://%s.disqus.com/embed.js" $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>.
@@ -16,8 +17,8 @@
{{- end -}}
{{- /* Gitalk Comment System */ -}}
{{- if $comment.gitalk.enable -}}
{{- $gitalk := $comment.gitalk -}}
{{- $gitalk := $comment.gitalk | default dict -}}
{{- if $gitalk.enable -}}
<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" -}}
@@ -30,8 +31,8 @@
{{- end -}}
{{- /* Valine Comment System */ -}}
{{- if $comment.valine.enable -}}
{{- $valine := $comment.valine -}}
{{- $valine := $comment.valine | default dict -}}
{{- if $valine.enable -}}
<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" -}}
@@ -57,8 +58,8 @@
{{- end -}}
{{- /* Facebook Comment System */ -}}
{{- if $comment.facebook.enable -}}
{{- $facebook := $comment.facebook -}}
{{- $facebook := $comment.facebook | default dict -}}
{{- if $facebook.enable -}}
<div id="fb-root" class="comment"></div>
<div
class="fb-comments"
@@ -74,8 +75,8 @@
{{- end -}}
{{- /* Telegram Comments System */ -}}
{{- if $comment.telegram.enable -}}
{{- $telegram := $comment.telegram -}}
{{- $telegram := $comment.telegram | default dict -}}
{{- if $telegram.enable -}}
<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) -}}
@@ -101,7 +102,8 @@
{{- end -}}
{{- /* Commento Comment System */ -}}
{{- if $comment.commento.enable -}}
{{- $commento := $comment.commento | default dict -}}
{{- if $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>
@@ -110,9 +112,9 @@
{{- end -}}
{{- /* Utterances Comment System */ -}}
{{- if $comment.utterances.enable -}}
{{- $utterances := $comment.utterances | default dict -}}
{{- if $utterances.enable -}}
<div id="utterances"></div>
{{- $utterances := $comment.utterances -}}
{{- $commentConfig = dict "repo" $utterances.repo | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = $utterances.issueTerm | default "pathname" | dict "issueTerm" | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = dict "label" $utterances.label | dict "utterances" | merge $commentConfig -}}