night0721.xyz/layouts/partials/icon.html
2023-11-07 20:55:50 +00:00

5 lines
326 B
HTML

{{- $fname:=print "assets/icons/" .icon ".svg" -}}
{{- $svg := readFile $fname -}}
{{- $filledPathSvg := replace $svg "<path" "<path fill='currentColor'" -}}
{{- $titledSvg := replaceRE "<svg (.*?)>" (printf `<svg role="img" width="28" height="28" $1 ><title>%s</title>` .title) $filledPathSvg -}}
{{ $titledSvg | safeHTML }}