night0721.xyz/layouts/partials/icon.html

6 lines
326 B
HTML
Raw Normal View History

2023-11-07 21:55:50 +01:00
{{- $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 }}