HUGO

Error rendering partial template

I’m having an issue with rendering my partial template, but I wasn’t able to spot the issue. Maybe you would be able to help me with finding it?

Template:

{{$slice := slice "first" "second" }}

{{range $slice}}
{{$headlessbundle := $.Site.GetPage (printf "/featured/%s" .)}}
{{range ($headlessbundle.Resources.ByType "page")}}
    {{.Title}} - {{.Description}} - {{.Content}}
{{end}}
{{range ($headlessbundle.Resources.ByType "image")}}
<img src="{{.RelPermalink}}>
    {{end}}
{{end}}

Error:

Error: Error building site: failed to render pages: render of "home" failed: execute of template failed: template: index.html:5:7: executing "main" at <partial "featured.html" .>: error calling partial: execute of template failed: html/template:partials/featured.html:8:8: on range loop re-entry: {{range}} branches end in different contexts: {stateURL delimDoubleQuote urlPartPreQuery jsCtxRegexp attrURL elementNone <nil>}, {stateText delimNone urlPartNone jsCtxRegexp attrNone elementNone <nil>}

Thanks a lot in advance.

You are missing a closing quote.

Thanks. Those brackets make it hard to spot.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.