I am trying to get the first index of images
params when using .Paginate
with the following code
{{ range (.Paginate (.Pages.GroupByPublishDate "2006")).PageGroups }}
<h2>{{.Key}}</h2>
{{ range .Pages }}
<article class="uk-article">
<figure>
<img src="{{ index .Params.images 0 }}" alt="" uk-img>
</figure>
<a class="uk-article-title"><a class="uk-link-reset" href="{{.Permalink}}">{{.Title}}</a></h3>
<p class="uk-article-meta">
<time datetime="{{.PublishDate}}" itemprop="datePublished" class="uk-text-left">{{.PublishDate.Format "01-02-2006"}}</time>
</p>
</article>
{{ end }}
{{end}}
When I try to run this I get the following error:
ERROR 2019/01/04 16:19:43 render of "section" failed: "/Users/akshayrajgollahalli/GitHub/gollahalli.com/themes/Spark/layouts/blog/list.html:15:45": execute of template failed: template: blog/list.html:15:45: executing "main" at <index .Params.images...>: error calling index: index of untyped nil
Total in 89 ms
ERROR 2019/01/04 16:19:43 Rebuild failed:
ERROR 2019/01/04 16:19:43 Failed to render pages: render of "section" failed: "/Users/akshayrajgollahalli/GitHub/gollahalli.com/themes/Spark/layouts/blog/list.html:15:45": execute of template failed: template: blog/list.html:15:45: executing "main" at <index .Params.images...>: error calling index:index of untyped nil
I am not sure why I getting this error, if I use the index
function out of the .Paginate
it works fine. Anyone getting the same error?