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 index.md in the content/posts/post-name directory working as it were a content/posts/post-name.md.

But the documentation pages https://gohugo.io/content-management/page-bundles/ and https://gohugo.io/content-management/page-resources/ 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
resources:
- 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 https://github.com/gohugoio/hugoDocs/issues/1010

As to the docs: there’s not a lot you are missing, just an image that’s meant to be included: https://github.com/gohugoio/hugoDocs/blob/master/content/en/content-management/organization/1-featured-content-bundles.png


beat me to it! :slight_smile:

1 Like

I have also opened an issue with the theme itself: