Ananke theme - featured images not displayed when baseURL includes subdirectory

I am using Hugo v0.100.1+extended installed using homebrew on Mac with the ananke theme. I’ve setup the structure to use page bundles and have images showing correctly when embedded inline in a post. I am struggling with the featured images on post content.

I’m able to display a featured image for pages if the image is in the static/images folder and referenced via an absolute url (i.e. ‘/images/exampleImage.png’)+

but I’m unable to display any featured images stored within the page bundle using a relative url (e.g. ‘exampleImage.png’ or ‘./exampleImage.png’)

This may also be related to the fact that my site is using an additional path element within the baseURL, e.g. baseURL = ‘site.hostname/project’
so when then url is generated when using a relative URL is
http://localhost:1313/project/project/posts/2022/03/24/exampleImage.png
note: the duplication of ‘project’ in the generated URL.

Is this related to the way in which the image url is generated in the theme, or is this part of the core Hugo functionality?

You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project.

See Requesting Help.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Yes. This issue is specific to the Ananke theme, and should be raised here:
https://github.com/theNewDynamic/gohugo-theme-ananke/issues

The problem is here:
https://github.com/theNewDynamic/gohugo-theme-ananke/blob/master/layouts/_default/summary-with-image.html#L7

To reproduce the problem:

git clone --single-branch -b hugo-forum-topic-38963 https://github.com/jmooring/hugo-testing hugo-forum-topic-38963
cd hugo-forum-topic-38963
hugo server

Then visit http://localhost:1313/foo/

Thanks @jmooring - that matches exactly what I’ve been experiencing. That was my suspicion but not having enough experience with Hugo, I only had a suspicion that I couldn’t confirm

1 Like

Raised as issue #556 on Ananke theme GitHub repo.

Having looked through the HUGO documentation for function absURL and relURL, the only way to get the featured_images to work with page bundles is to include the document path to the page in the resource path,

e.g. feature_image: ‘/posts/2022/03/24/exampleImage.png’

in my previous example.
Note: I would consider this a workaround, not a solution.

That’s not entirely true. I have a highly modified version of Ananke which does featured images with page bundles:

but the templates are overly complex — fixing that is on my to do list.

A post was split to a new topic: Featured image not working with Ananke theme