🥅 Catch any cases where resources don't exist

pull/2/head
James Panther 2021-08-16 14:04:56 +10:00
parent b114f3be73
commit 5575d2b43e
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
3 changed files with 28 additions and 14 deletions

View File

@ -1,5 +1,6 @@
{{ define "main" }}
{{ partial "section-heading.html" . }}
{{ if gt .Pages 0 }}
<section>
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
{{ if $.Site.Params.list.groupByYear }}
@ -12,4 +13,11 @@
{{ end }}
</section>
{{ partial "pagination.html" . }}
{{ else }}
<section class="mt-10 prose dark:prose-light">
<p class="py-8 border-t">
<em>There's no articles to list here yet.</em>
</p>
</section>
{{ end }}
{{ end }}

View File

@ -1,4 +1,6 @@
<span class="relative inline-block align-text-bottom icon">
{{ $icon := resources.Get (print "icons/" . ".svg") }}
{{ if $icon }}
{{ $icon.Content | safeHTML }}
{{ end }}
</span>

View File

@ -1,4 +1,8 @@
<span class="relative inline-block align-text-bottom icon">
{{ $icon := resources.Get (print "icons/" . ".svg") }}
{{ $icon := resources.Get (printf "icons/%s.svg" ($.Get 0)) }}
{{ if $icon }}
{{ $icon.Content | safeHTML }}
{{ else }}
<em>Icon not found.</em>
{{ end }}
</span>