chipzoller / hugo-clarity

A theme for Hugo based on VMware Clarity
Other
582 stars 267 forks source link

Breaking bug: nil pointer evaluating at resource.Resource.MediaType #311

Closed 0xTanvir closed 2 years ago

0xTanvir commented 2 years ago

Actual error:

..................
/themes/hugo-clarity/layouts/partials/image.html:31:18": 
execute of template failed: template: partials/image.html:31:18: 
executing "partials/image.html" at <$image.MediaType.MainType>: nil pointer evaluating resource.Resource.MediaType

Why and how? I was trying to render an image that was returning a 404 status code, So resources.GetRemote was returned nil, and the site failed to build.

both of these places cause this error.

Hotfix : I simply solved this by checking nil {{- if $image -}}

Desktop :

rootwork commented 2 years ago

@0xTanvir Do you have the latest version? #305 fixed exactly this issue.

0xTanvir commented 2 years ago

Sorry, my bad, I do not have the latest version, I have one week earlier version.