HUGO

OpenGraph not loading image unless being ["image.png"]

I’ve implemented Netlify CMS on my site (Github repo) and I’m having problems with Opengraph.

I have to use square brackets and quotation marks (as shown below), or otherwise it would give me an error.
images: ["/img/reflect_fc170c06-64e3-455e-860f-2554830312dc.png"]

This is the error I get if I try to push the image without square brackets and quotation marks

10:25:02 AM: Error: Error building site: failed to render pages: render of "page" failed: "/opt/build/repo/layouts/blog/single.html:5:44": execute of template failed: template: _internal/opengraph.html:5:44: executing "_internal/opengraph.html" at <.>: range can't iterate over /img/r
​
10:25:02 AM: ────────────────────────────────────────────────────────────────
10:25:02 AM:   "build.command" failed                                        
10:25:02 AM: ────────────────────────────────────────────────────────────────
10:25:02 AM: ​
10:25:02 AM:   Error message
10:25:02 AM:   Command failed with exit code 255: hugo
10:25:02 AM: ​
10:25:02 AM:   Error location

Your theme is using the internal opengraph template: https://gohugo.io/templates/internal#configure-open-graph

It needs an array for the images:

The first 6 URLs from the images array are used for image metadata.

Thanks.

I modified my Netlify CMS image field to be a list, and now it works!

- { label: 'Images', name: 'images', widget: "list", summary: '{{fields.image}}', field: {label: Image, name: image, widget: image}, required: false}

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