mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
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:
@@ -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" . -}}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user