fix(assets): fix nil pointer in icon.html and correct QQ icon names

Use `with` block to guard against nil resource in icon.html, preventing
panic when `resources.Get` fails. Correct simple-icons names from
`tencentqq` to `qq` for QQ and QQ Group social links.
This commit is contained in:
Cell
2026-07-10 21:12:56 +08:00
parent a2d756777f
commit b5419ef704
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
{{- hugo.Store.Set "version" "v1.0.0-mrevbfi8" -}}
{{- hugo.Store.Set "version" "v1.0.0-mreyhf6g" -}}
{{- .Store.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}
+4 -4
View File
@@ -23,12 +23,12 @@
{{- end -}}
{{- if (urls.Parse $src).Host | not -}}
{{- $resource := resources.Get $src | minify -}}
{{ if not $resource }}
{{- with resources.Get $src -}}
{{- $resource := . | resources.Minify -}}
{{- $resource.Content | replaceRE `<svg ` `<svg class="icon" ` | safeHTML -}}
{{- else -}}
{{- errorf "Icon does not exist %v" $src -}}
{{- end -}}
{{- $resource := $resource.Content -}}
{{- $resource | replaceRE `<svg ` `<svg class="icon" ` | safeHTML -}}
{{- else -}}
{{- /* fetch svg icon from external source */ -}}
<i data-svg-src="{{ $src }}" aria-hidden="true"></i>