perf(home): disable third-party resource loading on the home page, and improve plugin comments

This commit is contained in:
Cell
2026-04-30 19:48:52 +08:00
parent cedff8610b
commit 502e427a0c
26 changed files with 200 additions and 45 deletions
+1 -4
View File
@@ -1,5 +1,5 @@
{{- $jsonViewer := .Attributes | merge .Page.Params.jsonViewer | merge .Page.Site.Params.jsonViewer -}}
{{- if $jsonViewer.enable -}}
{{- if $jsonViewer.enable | and (ne hugo.Context.MarkupScope "home") -}}
{{- $attrs := printf `expand-depth="%v"` $jsonViewer.expanddepth -}}
{{- $copyable := false -}}
{{- with $jsonViewer.copyable -}}
@@ -13,9 +13,6 @@
{{- end -}}
<json-viewer value="{{ .Inner | jsonify }}" {{ $attrs | safeHTMLAttr }}{{ with $copyable}} copyable="{{ . | jsonify }}"{{ end }}></json-viewer>
{{- .Page.Store.Set "hasJsonViewer" true -}}
{{- if eq hugo.Context.MarkupScope "home" -}}
{{- site.Home.Store.Set "hasJsonViewer" true -}}
{{- end -}}
{{- else -}}
{{- partial "plugin/code-block-wrapper.html" . -}}
{{- end -}}