hugo-theme-anubis2/layouts/partials/font-awesome.html
Maksim Iakunin 3905dee767
#98: replacing readFile with partial for predefined icons
This approach has been taken from another popular hugo-theme `ananke`:
e3f7fbe39d/layouts/partials/social-follow.html (L41)
2021-09-30 18:35:35 +03:00

16 lines
390 B
HTML

<span class="inline-svg" >
{{ $dict := newScratch }}
{{ if (eq .custom true) }}
{{ $dict.Set "svg" (readFile (print "static/fa-icons/" .iconName ".svg")) }}
{{ else }}
{{ $dict.Set "svg" (partial (print "fa-icons/" .iconName ".svg")) }}
{{ end }}
{{- $path:="<path" -}}
{{- $fill:="<path fill=\"currentColor\"" -}}
{{ replace ($dict.Get "svg") $path $fill | safeHTML }}
</span>