Image processing on homepage

Is it possible to use image processing on homepage? I have an image file content/homepage_background.jpg
I tried to add a content/ file, but it says “Permission denied”. Is there a way to use image processing without a section?

We will need more info than this to help you troubleshoot. Can you share your project?

What parts do you need?

A link to the whole thing would be best. As I don’t even know if that “Permission denied” error you’re getting is hugo-related.

To answer your homepage image processing question, yes this is possible.

Given this content structure:

│       painting.jpg

Then you could do something like this in your layouts/index.html template:

{{ $img := .Resources.GetMatch "painting.jpg" }}
{{ $img }}

I have realized that this is probably a Hugo bug.
The permission error was because when I try to create a content file directly under the content/ directory, it tries to create it in operating system root (/) instead of project dir.
Same behavior with newly created empty project.


  • content/
  • content/


  • content/my-posts/ (it is under a subdirectory)
  • anything_other_than_content/ (automatically prepends content)

I disagree. This sounds like an issue with your particular environment setup. What OS are you using? And how are you trying to create these content files?

I am using Void Linux.
Hugo Static Site Generator v0.54.0 linux/amd64 BuildDate: unknown

How to reproduce:

hugo new site test_page
cd test_page
hugo new content/

I can access the image indeed when an file is created.
Just I had to create it with hugo new instead of hugo new content/

Here’s your issue. This is wrong. Do it like this instead:

hugo new