Error when loading author image with Toha theme

Hi there,

I’m getting the following error when trying to load a png in my site.
I’m using the latest version of hugo with the Toha template and I’m trying to follow the setup guide listed here.

When trying to set the image inside the author.yaml file, and the file exists in my resources/_gen/images/author/author.png I get the following error:

ERROR 2022/08/08 16:34:56 Failed to render pages: render of “home” failed: execute of template failed: template: index.html:42:8: executing “index.html” at <partial “sections/home.html” .>: error calling partial: “/themes/toha/layouts/partials/sections/home.html:31:44”: execute of template failed: template: partials/sections/home.html:31:44: executing “partials/sections/home.html” at <$authorImage.MediaType.SubType>: nil pointer evaluating resource.Resource.MediaType

Has anyone faced this issue before?

Best regards!

It would help if you shared a link to your repo.

Where are you storing the image? In assets/images/author/?

I’ve figured it out. I was placing the images on the root resources folder. The theme was expecting these to be inside the resources/images folder inside the theme folder.

:man_facepalming:

No.

The resources directory is a cache. See https://gohugo.io/getting-started/directory-structure/#directory-structure-explained.

With this data/en/author.yaml:

image: "images/author/john.png"

Place your image here:

assets/
└── images/
    └── author/
        └── john.png
2 Likes

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