Use Page Resources img instead of from static in hugo-cards theme

I came here looking for help trying add some images to the space next to the story itself. I have managed to get the in the content/posts/post-name directory working as it were a content/posts/

But the documentation pages and are totally unclear to someone pretty new to hugo - listing the “resources” in the front matter does not seem to do much by itself. I think they serve as a kind of reference information for those who are much deeper into this.

A theme I am using hugo-cards theme displays the image pointed to by img in the front matter in the page listing. How do I tell that img is one of my page resources?

Tried this:

title: "My post"
date: 2019-11-22T21:00:00Z
draft: true
- src: 'frontimage.jpeg'
  name: 'img'


I think this is totally “wrong” but how do I achieve this with page resources?

In the plain post the following works:

title: "My post"
date: 2019-11-22T21:00:00Z
draft: true
img: frontimage.jpeg

but then the image must to come from the “global pool” - in my case this is simply /static/images.

Hi there,

I moved your question to a new topic as the one you were replying to is 2 years old now.

The reason you cannot use page resources as the sidebar image is because the theme you are using constructs the img src urls with the assumption that your images are in static/images/. You can see that here and here.

You could either ask the theme maintainer to add code to support your use case, or you can overwrite the two files I linked to above yourself.

Yes, that’s fine, I am new to this and to this theme therefore I understand it is probably an unsupported feature in the theme itself.

But unfortunately the page resources documentation is extremely confusing to a beginner and this should be pointed out in the original thread; sadly the docs didn’t change much since that…

I have edited the post to make it clearly about more specific about hugo-cards and split the documentation look issue to

As to the docs: there’s not a lot you are missing, just an image that’s meant to be included:

beat me to it! :slight_smile:

1 Like

I have also opened an issue with the theme itself: