mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-14 02:46:16 +01:00
fix(compatibility): compatibility for version 0.1.X (#351)
This commit is contained in:
parent
7d0603ece0
commit
7c4962e39a
4 changed files with 39 additions and 19 deletions
|
@ -17,11 +17,17 @@
|
|||
{{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}}
|
||||
{{- .Scratch.Set "analytics" .Site.Params.analytics -}}
|
||||
{{- .Scratch.Set "comment" $params.comment -}}
|
||||
{{- if eq .Params.comment true -}}
|
||||
{{- .Scratch.Set "comment" .Site.Params.comment -}}
|
||||
{{- else if eq .Params.comment false -}}
|
||||
{{- .Scratch.Set "comment" dict -}}
|
||||
{{- end -}}
|
||||
{{- else if eq .Site .Sites.First -}}
|
||||
{{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\" 和 \"fingerprint\" 不会启用.\n" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- .Scratch.Set "params" $params -}}
|
||||
|
||||
{{- $this := dict "desktop" .Site.Params.header.desktopMode "mobile" .Site.Params.header.mobileMode | dict "headerMode" | dict "config" -}}
|
||||
{{- .Scratch.Set "this" $this -}}
|
||||
|
||||
|
|
|
@ -89,8 +89,13 @@
|
|||
{{- end -}}
|
||||
|
||||
{{- /* KaTeX */ -}}
|
||||
{{- if $params.math.enable -}}
|
||||
{{- $math := $params.math -}}
|
||||
{{- $math := $params.math -}}
|
||||
{{- if eq $math true -}}
|
||||
{{- $math = .Site.Params.page.math | default dict -}}
|
||||
{{- else if eq $math false -}}
|
||||
{{- $math = dict "enable" false -}}
|
||||
{{- end -}}
|
||||
{{- if $math.enable -}}
|
||||
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
|
||||
{{- dict "source" $source "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
|
||||
{{- $source := $cdn.katexJS | default "lib/katex/katex.min.js" -}}
|
||||
|
|
|
@ -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 -}}
|
||||
|
|
|
@ -3,11 +3,18 @@
|
|||
{{- define "content" -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
|
||||
{{- $toc := $params.toc -}}
|
||||
{{- if eq $toc true -}}
|
||||
{{- $toc = .Site.Params.page.toc | default dict -}}
|
||||
{{- else if eq $toc false -}}
|
||||
{{- $toc = dict "enable" false -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Auto TOC */ -}}
|
||||
{{- if ne $params.toc.enable false -}}
|
||||
{{- if ne $toc.enable false -}}
|
||||
<div class="toc" id="toc-auto">
|
||||
<h2 class="toc-title">{{ T "contents" }}</h2>
|
||||
<div class="toc-content{{ if eq $params.toc.auto false }} always-active{{ end }}" id="toc-content-auto"></div>
|
||||
<div class="toc-content{{ if eq $toc.auto false }} always-active{{ end }}" id="toc-content-auto"></div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
|
@ -66,7 +73,7 @@
|
|||
{{- end -}}
|
||||
|
||||
{{- /* Static TOC */ -}}
|
||||
{{- if ne $params.toc.enable false -}}
|
||||
{{- if ne $toc.enable false -}}
|
||||
<div class="details toc" id="toc-static">
|
||||
<div class="details-summary toc-title">
|
||||
<span>{{ T "contents" }}</span>
|
||||
|
|
Loading…
Reference in a new issue