diff options
author | Humberto Rocha <humrochagf@gmail.com> | 2022-05-28 01:52:02 +0300 |
---|---|---|
committer | Humberto Rocha <humrochagf@gmail.com> | 2022-05-28 01:52:02 +0300 |
commit | 6bba2cf88333db35574312430d065408783248e7 (patch) | |
tree | 1d76648c359e81ecb3ab776ff92a69cbcc36c7d2 | |
parent | 488f4142d11f3e6cd650bae67d72f4b8d9a03a53 (diff) |
Fix backwards compatibility on images to accept image as list of paths
-rw-r--r-- | layouts/_default/taxonomy.html | 11 | ||||
-rw-r--r-- | layouts/blog/list.html | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index a90182e..c372527 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -21,13 +21,20 @@ {{ $image := index .Params.images 0 }} <a href="{{ .Permalink }}"> <img - src="{{ $image.src | safeURL }}" + {{ if reflect.IsMap $image }} + src="{{ $image.src | safeURL }}" + {{ else }} + src="{{ $image | safeURL }}" + {{ end }} alt="{{ .Title }}" title="{{ .Title }}" /> </a> - {{ if ne nil $image.attribution }} + {{ if and + (reflect.IsMap $image) + (ne nil $image.attribution) + }} <div class="attribution"> {{ print $image.attribution | safeHTML }} </div> diff --git a/layouts/blog/list.html b/layouts/blog/list.html index f253233..4cc5da6 100644 --- a/layouts/blog/list.html +++ b/layouts/blog/list.html @@ -21,13 +21,20 @@ {{ $image := index .Params.images 0 }} <a href="{{ .Permalink }}"> <img - src="{{ $image.src | safeURL }}" + {{ if reflect.IsMap $image }} + src="{{ $image.src | safeURL }}" + {{ else }} + src="{{ $image | safeURL }}" + {{ end }} alt="{{ .Title }}" title="{{ .Title }}" /> </a> - {{ if ne nil $image.attribution }} + {{ if and + (reflect.IsMap $image) + (ne nil $image.attribution) + }} <div class="attribution"> {{ print $image.attribution | safeHTML }} </div> |