Added some defensive programming if the site doesn't have recommendations.

This commit is contained in:
Leon Mika 2024-03-17 10:28:43 +11:00
parent bb07ca780e
commit a9f0437fc7
2 changed files with 2 additions and 2 deletions

View file

@ -2,7 +2,7 @@
<header> <header>
<h1>Recommendations</h1> <h1>Recommendations</h1>
</header> </header>
{{ if .Site.Data.blogrolls.recommendations }} {{ if and (.Site.Data.blogrolls) (.Site.Data.blogrolls.recommendations) }}
<ul class="blogroll"> <ul class="blogroll">
{{ range .Site.Data.blogrolls.recommendations }} {{ range .Site.Data.blogrolls.recommendations }}
<li><a href="{{ .url }}">{{ .name }}: <span>{{ (urls.Parse .url).Hostname }}</span></a></li> <li><a href="{{ .url }}">{{ .name }}: <span>{{ (urls.Parse .url).Hostname }}</span></a></li>

View file

@ -1,5 +1,5 @@
{ {
"version": "1.0.0", "version": "1.0.1",
"title": "Sidebar for Tiny Theme", "title": "Sidebar for Tiny Theme",
"description": "Adds a sidebar to a blog using Tiny Theme", "description": "Adds a sidebar to a blog using Tiny Theme",
"includes": [ "includes": [