Render of "section" failed:

I’m getting this error when compiling hugo:

execute of template failed: template: _default/list.html:5:19: executing “main” at <$imagen.RelPermalink>: nil pointer evaluating resource.Resource.RelPermalink

it’s pointing to the image that I’ve at the top of the section.
I’ve different sections and each of them has a different picture. All the pictures are in a folder.

If I try to generate the site is raising this is error, but if I comment the line:
<img src="{{$imagen.RelPermalink}}" width="100%">
I can create the site and serve it. After I can uncomment and the site will work perfectly, finding the pictures and creating the pages correctly without any error.

Any ideas on how to generate the site removing the error? Everything seems to be alright apart of that.
This is the site: GitHub - robergimenez/hugo

I think you’re not “compiliing Hugo” but rather trying to have Hugo generate your web site.

The error indicates that the image does not exist (typo, wrong path, whatever). I suggest that you program defensively (searching for that term in the forum will turn up several examples, since other people stumbled upon the same problem before).

{{with $imagen}}
<img src="{{$imagen.RelPermalink}}" width="100%">
{{else}}
{{errorf "%s not found" $cabeceraName}}
{{end}}

That will still throw an error, but at least you know why.

Aside: Please fix your original post, as the line you want to quote (“if I comment the line:”) is not visible.

Thanks for the insights. They have been very useful and I’ve modified my post.
As you said I can see that Hugo is looking for all the images of all the sections, but I was just looking for the 5 categories that I have, no more. This is why I coded this way:

{{ $cabeceraName := printf "images/cabeceras/%s.webp" (lower .Title) | urlize}}

Since it should be only one title per 5 categories, but the system is looking for all the pictures of all the sections, not the categories.

As @arif noted, your Github repo does not work at all. It can’t work locally on your machine, either. Hugo doesn’t find your rawhtml shortcode because your shortcodes directory is in a completely bogus place. After fixing that, Hugo fails because the head.html partial is missing.

Please provide a repository that shows your problem. You’re wasting time directing us to a repository that is not even remotely close to what you are asking here.