#200#issuecomment-860025299

This commit is contained in:
zhixuan 2021-06-13 12:42:44 +09:00
parent eebd5ade09
commit ea0bdeca5d
No known key found for this signature in database
GPG Key ID: 05D14AD50C51A06F
2 changed files with 27 additions and 21 deletions

View File

@ -70,15 +70,20 @@ params:
# Waline 前端配置参见 https://waline.js.org/reference/client.html
# Waline client configuration see: https://waline.js.org/en/reference/client.html
waline:
serverURL:
serverURL:
lang:
visitor:
avatar:
emoji:
dark: auto
admin:
- emoji URL 1
- emoji URL 2
requiredMeta:
- name
- email
- url
placeholder:
locale:
admin: test
widgets:
enabled:

View File

@ -7,25 +7,26 @@
box-shadow: var(--shadow-l1);
padding: var(--card-padding);
}
.waline-container .vcount {
color: var(--card-text-color-main);
}
</style>
{{- with .Site.Params.comments.waline -}}
<script>
// 本页配置参见 https://waline.js.org/reference/client.html
// Waline client configuration see: https://waline.js.org/en/reference/client.html
new Waline({
el: '#waline',
serverURL: '{{ .serverURL }}',
lang: '{{ .lang }}',
visitor: '{{ .visitor }}',
avatar: '{{ .avatar }}',
emoji: ['{{ .emoji }}'],
dark: '{{ .dark }}',
requiredMeta: ['{{ .requiredMeta }}'],
locale: {
admin: '{{ .admin }}',
placeholder: '{{ .placeholder }}',
},
});
</script>
{{- $config := dict "el" "#waline" "dark" "body[data-scheme=\"dark\"]" -}}
{{- $replaceKeys := dict "serverurl" "serverURL" "requiredmeta" "requiredMeta" "wordlimit" "wordLimit" "pagesize" "pageSize" "avatarcdn" "avatarCDN" "avatarforce" "avatarForce" -}}
{{- range $key, $val := . -}}
{{- if $val -}}
{{- $replaceKey := index $replaceKeys $key -}}
{{- $k := default $key $replaceKey -}}
{{- $config = merge $config (dict $k $val) -}}
{{- end -}}
{{- end -}}
<script>
/// Waline client configuration see: https://waline.js.org/en/reference/client.html
new Waline({{ $config | jsonify | safeJS }});
</script>
{{- end -}}