fix: 'with' with a logic 'and', child variable evaluated

This commit is contained in:
leafee98 2022-05-18 22:44:17 +08:00
parent 0ce04d50c7
commit a71e469a23

View file

@ -12,17 +12,18 @@
{{ end }} {{ end }}
{{ with and .Site.Params.remark42 .Params.show_comments }} {{ with and .Site.Params.remark42 .Params.show_comments }}
{{ $remark42 := $.Site.Params.remark42 }}
<script> <script>
var remark_config = { var remark_config = {
host: '{{ .host }}', host: '{{ $remark42.host }}',
site_id: '{{ .host }}', site_id: '{{ $remark42.host }}',
components: ['embed', 'last-comments'], components: ['embed', 'last-comments'],
max_shown_comments: {{ .max_shown_comments }}, max_shown_comments: {{ $remark42.max_shown_comments }},
theme: '{{ .remark42.theme }}', theme: '{{ $remark42.theme }}',
page_title: '{{ .Title }}', page_title: '{{ $remark42.Title }}',
locale: '{{ .locale }}', locale: '{{ $remark42.locale }}',
show_email_subscription: {{ .show_email_subscription }}, show_email_subscription: {{ $remark42.show_email_subscription }},
simple_view: {{ .simple_view }} simple_view: {{ $remark42.simple_view }}
}; };
!function(e,n){for(var o=0;o<e.length;o++){var r=n.createElement("script"),c=".js",d=n.head||n.body;"noModule"in r?(r.type="module",c=".mjs"):r.async=!0,r.defer=!0,r.src=remark_config.host+"/web/"+e[o]+c,d.appendChild(r)}}(remark_config.components||["embed"],document); !function(e,n){for(var o=0;o<e.length;o++){var r=n.createElement("script"),c=".js",d=n.head||n.body;"noModule"in r?(r.type="module",c=".mjs"):r.async=!0,r.defer=!0,r.src=remark_config.host+"/web/"+e[o]+c,d.appendChild(r)}}(remark_config.components||["embed"],document);