4o1x5.dev/layouts/partials/utils/icon.html

15 lines
343 B
HTML
Raw Permalink Normal View History

2024-04-28 11:42:37 +02:00
{{/* Render raw svg icon from .Site.Data */}}
{{- $icon := index site.Data.icons .name -}}
{{- if not $icon -}}
{{ errorf "icon %q not found" .name }}
{{- end -}}
{{- $icon = $icon | safeHTML -}}
{{- if .attributes -}}
{{- $icon = replaceRE "<svg" (printf "<svg %s" .attributes) $icon -}}
{{- end -}}
{{- return ($icon | safeHTML) -}}