🥅 Catch any cases where resources don't exist

This commit is contained in:
James Panther
2021-08-16 14:04:56 +10:00
parent b114f3be73
commit 5575d2b43e
3 changed files with 28 additions and 14 deletions
+6 -2
View File
@@ -1,4 +1,8 @@
<span class="relative inline-block align-text-bottom icon">
{{ $icon := resources.Get (print "icons/" . ".svg") }}
{{ $icon.Content | safeHTML }}
{{ $icon := resources.Get (printf "icons/%s.svg" ($.Get 0)) }}
{{ if $icon }}
{{ $icon.Content | safeHTML }}
{{ else }}
<em>Icon not found.</em>
{{ end }}
</span>