Perf: optimize Artalk config (#54)

This commit is contained in:
Cell
2022-01-30 22:41:26 +08:00
parent 862d3130fe
commit 7d62af6ad2
7 changed files with 17 additions and 7 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -712,8 +712,10 @@ enableEmoji = true
# Artalk 评论系统设置 (https://artalk.js.org/) since v0.2.12
[params.page.comment.artalk]
enable = false
pageKey = ""
pageTitle = ""
server = "https://yourdomain/api/"
site = "your site name"
site = "默认站点"
placeholder = ""
noComment = ""
sendBtn = ""
@@ -504,8 +504,10 @@ Please open the code block below to view the complete sample configuration :(far
# {{< link "https://artalk.js.org/" Artalk >}} comment config (https://artalk.js.org/)
[params.page.comment.artalk]
enable = false
pageKey = ""
pageTitle = ""
server = "https://yourdomain/api/"
site = "your site name"
site = "默认站点"
placeholder = ""
noComment = ""
sendBtn = ""
@@ -515,8 +515,10 @@ hugo
# {{< link "https://artalk.js.org/" Artalk >}} 评论系统设置 (https://artalk.js.org/)
[params.page.comment.artalk]
enable = false
pageKey = ""
pageTitle = ""
server = "https://yourdomain/api/"
site = "你的网站名称"
site = "默认站点"
placeholder = ""
noComment = ""
sendBtn = ""
+1 -1
View File
@@ -13,7 +13,7 @@
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.artalkJS | default "lib/artalk/Artalk.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $commentConfig = dict "el" "#artalk" "server" $artalk.server "site" $artalk.site "placeholder" $artalk.placeholder "noComment" $artalk.noComment "sendBtn" $artalk.sendBtn "editorTravel" $artalk.editorTravel "flatMode" $artalk.flatMode "maxNesting" $artalk.maxNesting | dict "artalk" | merge $commentConfig -}}
{{- $commentConfig = dict "el" "#artalk" "pageKey" $artalk.pageKey "pageTitle" $artalk.pageTitle "server" $artalk.server "site" $artalk.site "placeholder" $artalk.placeholder "noComment" $artalk.noComment "sendBtn" $artalk.sendBtn "editorTravel" $artalk.editorTravel "flatMode" $artalk.flatMode "maxNesting" $artalk.maxNesting | dict "artalk" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://github.com/ArtalkJS/Artalk" rel="license external nofollow noopener noreffer">Artalk</a>.
</noscript>
+5 -1
View File
@@ -594,7 +594,11 @@ class Theme {
initComment() {
if (this.config.comment) {
if (this.config.comment.artalk){
new Artalk(this.config.comment.artalk)
const artalk = new Artalk(this.config.comment.artalk);
artalk.setDarkMode(this.isDark);
this.switchThemeEventSet.add(() => {
artalk.setDarkMode(this.isDark);
})
}
if (this.config.comment.gitalk) {
this.config.comment.gitalk.body = decodeURI(window.location.href);