Getting error on partials when building Hugo site

I am getting the Hugo Server error.

failed to render pages: render of "page" failed: "/Users/sanjai/hugo-site-cms/new-site/internal-docs-cms/layouts/_default/baseof.html:3:5": execute of template failed at <partial "head/head.html" .>: error calling partial: "/Users/sanjai/hugo-site-cms/new-site/internal-docs-cms/layouts/partials/head/head.html:8:29": execute of template failed at <partial "head/seo.html" .>: "/Users/sanjai/hugo-site-cms/new-site/internal-docs-cms/layouts/partials/head/seo.html:41:3": execute of template failed at <partial "head/opengraph.html" .>: "/Users/sanjai/hugo-site-cms/new-site/internal-docs-cms/layouts/partials/head/opengraph.html:38:19": execute of template failed at <.>: range can’t iterate over steve- 

Here is the link to the sample repo - GitHub - SanjaikumarR/internal-docs-cms

Also attaching a screenshot of the error log.

Can someone help me with why this error is occuring?

The relevant code in opengraph.html is

{{ with $.Params.images -}}
  {{ range first 6 . -}}

and in your third blog posting, you have this:

---
…
images: steve-image.jpg
…

So, images is a string there, but range in the partial expects an array (or a map in Hugo parlance). That can’t work.

It seems that you’re trying to use the Doks theme. If these kinds of gotchas are not explained in its documentation, you should maybe go and look for another theme. Or forego themes and start at zero to get to know Hugo.

1 Like