feat: support waline comment config

This commit is contained in:
Dillon 2022-07-09 23:26:02 +08:00
parent be636b2d78
commit 5248a6c3d2
No known key found for this signature in database
GPG key ID: 0EF4AE57FB98F108
25 changed files with 92 additions and 0 deletions

View file

@ -902,6 +902,8 @@ var Theme = /*#__PURE__*/function () {
this.switchThemeEventSet.add(this._giscusOnSwitchTheme); this.switchThemeEventSet.add(this._giscusOnSwitchTheme);
} }
if (this.config.comment.waline) Waline.init(this.config.comment.waline);
} }
} }
}, { }, {

View file

@ -585,6 +585,15 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
lazyLoading = false lazyLoading = false
lightTheme = "light" lightTheme = "light"
darkTheme = "dark" darkTheme = "dark"
# Waline comment config (https://waline.js.org/)
# Waline 评论系统设置 (https://waline.js.org/)
[params.page.comment.waline]
enable = false
serverURL = "https://love-it-waline.vercel.app"
# automatically adapt the current theme i18n configuration when empty
# 为空时自动适配当前主题 i18n 配置
lang = ""
emoji = ["https://unpkg.com/@waline/emojis@1.0.1/tw-emoji"]
# Third-party library config # Third-party library config
# 第三方库配置 # 第三方库配置
[params.page.library] [params.page.library]

View file

@ -62,6 +62,9 @@ other = "ar_AR"
[giscusLang] [giscusLang]
other = "en" other = "en"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "ca_ES"
[giscusLang] [giscusLang]
other = "en" other = "en"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "de_DE"
[giscusLang] [giscusLang]
other = "de" other = "de"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -61,6 +61,9 @@ other = "en_US"
[giscusLang] [giscusLang]
other = "en" other = "en"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "es_MX"
[giscusLang] [giscusLang]
other = "es" other = "es"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "fr"
[giscusLang] [giscusLang]
other = "fr" other = "fr"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "hi_IN"
[giscusLang] [giscusLang]
other = "en" other = "en"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "id_ID"
[giscusLang] [giscusLang]
other = "id" other = "id"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "it"
[giscusLang] [giscusLang]
other = "it" other = "it"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "ko-KR"
[giscusLang] [giscusLang]
other = "ko" other = "ko"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "pl"
[giscusLang] [giscusLang]
other = "pl" other = "pl"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "pt_BR"
[giscusLang] [giscusLang]
other = "en" other = "en"
[walineLang]
other = "pt-BR"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "ro_RO"
[giscusLang] [giscusLang]
other = "ro" other = "ro"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "ru_RU"
[giscusLang] [giscusLang]
other = "ru" other = "ru"
[walineLang]
other = "ru-RU"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "sr_RS"
[giscusLang] [giscusLang]
other = "en" other = "en"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -63,6 +63,9 @@ other = "te_IN"
[giscusLang] [giscusLang]
other = "en" other = "en"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "th_TH"
[giscusLang] [giscusLang]
other = "en" other = "en"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "tr_TR"
[giscusLang] [giscusLang]
other = "tr" other = "tr"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "vi"
[giscusLang] [giscusLang]
other = "vi" other = "vi"
[walineLang]
other = "en"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -62,6 +62,9 @@ other = "zh_CN"
[giscusLang] [giscusLang]
other = "zh-CN" other = "zh-CN"
[walineLang]
other = "zh-CN"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -59,6 +59,9 @@ other = "你的評論 ..."
[facebookLanguageCode] [facebookLanguageCode]
other = "zh_TW" other = "zh_TW"
[walineLang]
other = "zh-TW"
# === partials/comment.html === # === partials/comment.html ===
# === partials/assets.html === # === partials/assets.html ===

View file

@ -146,6 +146,23 @@
Please enable JavaScript to view the comments powered by <a href="https://giscus.app">Giscus</a>. Please enable JavaScript to view the comments powered by <a href="https://giscus.app">Giscus</a>.
</noscript> </noscript>
{{- end -}} {{- end -}}
{{- /* Waline Comment System */ -}}
{{- $waline := $comment.waline | default dict -}}
{{- if $waline.enable -}}
<div id="waline" class="comment"></div>
{{- $source := $cdn.walineCSS | default "lib/waline/waline.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.walineJS | default "lib/waline/waline.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $commentConfig = dict "el" "#waline" "serverURL" $waline.serverURL "lang" ($waline.lang | default (T "walineLang")) | dict "waline" | merge $commentConfig -}}
{{- with $waline.emoji -}}
{{- $commentConfig = dict "emoji" . | dict "waline" | merge $commentConfig -}}
{{- end -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://waline.js.org/">Waline</a>.
</noscript>
{{- end -}}
</div> </div>
{{- end -}} {{- end -}}

View file

@ -678,6 +678,7 @@ class Theme {
}); });
this.switchThemeEventSet.add(this._giscusOnSwitchTheme); this.switchThemeEventSet.add(this._giscusOnSwitchTheme);
} }
if (this.config.comment.waline) Waline.init(this.config.comment.waline);
} }
} }