#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)
This commit is contained in:
parent
9ca723f576
commit
3905dee767
16 changed files with 5 additions and 5 deletions
|
@ -1,15 +1,15 @@
|
|||
<span class="inline-svg" >
|
||||
|
||||
|
||||
{{ $dict := newScratch }}
|
||||
|
||||
{{ if (eq .custom true) }}
|
||||
{{ $dict.Set "filename" (print "static/fa-icons/" .iconName ".svg") }}
|
||||
{{ if (eq .custom true) }}
|
||||
{{ $dict.Set "svg" (readFile (print "static/fa-icons/" .iconName ".svg")) }}
|
||||
{{ else }}
|
||||
{{ $dict.Set "filename" (print "themes/anubis/static/fa-icons/" .iconName ".svg") }}
|
||||
{{ $dict.Set "svg" (partial (print "fa-icons/" .iconName ".svg")) }}
|
||||
{{ end }}
|
||||
|
||||
{{- $path:="<path" -}}
|
||||
{{- $fill:="<path fill=\"currentColor\"" -}}
|
||||
{{ replace (readFile ($dict.Get "filename")) $path $fill | safeHTML }}
|
||||
{{ replace ($dict.Get "svg") $path $fill | safeHTML }}
|
||||
|
||||
</span>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue