Merge pull request #3 from zhixuan666/#200

#200
This commit is contained in:
暁学生 2021-06-13 20:04:30 +08:00 committed by GitHub
commit a4a66eb77a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 26 deletions

View File

@ -70,14 +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:
admin:
- emoji URL 1
- emoji URL 2
requiredMeta:
- name
- email
- url
placeholder:
locale:
admin: test
widgets:
enabled:

View File

@ -1,9 +1,9 @@
---
title: "Test"
description: "This is a example category"
description: "This is an example category"
slug: "test"
image: "hutomo-abrianto-l2jk-uxb1BY-unsplash.jpg"
style:
background: "#2a9d8f"
color: "#fff"
---
---

View File

@ -28,7 +28,7 @@ widget:
search:
title:
other: サーチ
other: 検索
placeholder:
other: 入力...
resultTitle:

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: 'body[data-scheme="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 -}}

View File

@ -21,5 +21,5 @@
<link rel="shortcut icon" href="{{ . }}" />
{{ end }}
{{- template "_internal/google_analytics_async.html" . -}}
{{- template "_internal/google_analytics.html" . -}}
{{- partial "head/custom.html" . -}}

View File

@ -8,7 +8,7 @@
{{ $url := urls.Parse $imageValue }}
{{ if or (eq $url.Scheme "http") (eq $url.Scheme "https") }}
<!-- Is a external image -->
<!-- Is an external image -->
{{ $result = merge $result (dict "permalink" $imageValue) }}
{{ else }}
{{ $pageResourceImage := .Context.Resources.GetMatch (printf "%s" ($imageValue | safeURL)) }}
@ -58,4 +58,4 @@
{{ end }}
{{ return $result }}
{{ return $result }}