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);
}
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
lightTheme = "light"
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
# 第三方库配置
[params.page.library]

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -59,6 +59,9 @@ other = "你的評論 ..."
[facebookLanguageCode]
other = "zh_TW"
[walineLang]
other = "zh-TW"
# === partials/comment.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>.
</noscript>
{{- 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>
{{- end -}}

View file

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