# Ananke theme - featured images not displayed when baseURL includes subdirectory

**URL:** <https://discourse.gohugo.io/t/ananke-theme-featured-images-not-displayed-when-baseurl-includes-subdirectory/38963>\
**Category:** Using Themes\
**Created:** [June 8, 2022, 7:59am UTC](https://discourse.gohugo.io/t/ananke-theme-featured-images-not-displayed-when-baseurl-includes-subdirectory/38963 "2022-06-08T07:59:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![robexley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/robexley/32/17057_2.png) [@robexley](https://discourse.gohugo.io/u/robexley)\
**Post date:** [June 8, 2022, 7:59am UTC](https://discourse.gohugo.io/t/ananke-theme-featured-images-not-displayed-when-baseurl-includes-subdirectory/38963/1 "2022-06-08T07:59:59Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![tut](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tut](https://discourse.gohugo.io/u/tut)\
**Post date:** [June 8, 2022, 9:58am UTC](https://discourse.gohugo.io/t/ananke-theme-featured-images-not-displayed-when-baseurl-includes-subdirectory/38963/2 "2022-06-08T09:58:51Z")

</div>

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](https://discourse.gohugo.io/t/requesting-help/9132).

> 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.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [June 8, 2022, 6:06pm UTC](https://discourse.gohugo.io/t/ananke-theme-featured-images-not-displayed-when-baseurl-includes-subdirectory/38963/3 "2022-06-08T18:06:53Z")

</div>

> [@robexley](#):
>
> Is this related to the way in which the image url is generated in the theme

Yes. This issue is specific to the Ananke theme, and should be raised here:  
[https://github.com/theNewDynamic/gohugo-theme-ananke/issues](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](https://github.com/theNewDynamic/gohugo-theme-ananke/blob/master/layouts/_default/summary-with-image.html#L7)

To reproduce the problem:

```bash
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/`

---

<div class="post-metadata">

**Author:** ![robexley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/robexley/32/17057_2.png) [@robexley](https://discourse.gohugo.io/u/robexley)\
**Post date:** [June 8, 2022, 6:48pm UTC](https://discourse.gohugo.io/t/ananke-theme-featured-images-not-displayed-when-baseurl-includes-subdirectory/38963/4 "2022-06-08T18:48:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![robexley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/robexley/32/17057_2.png) [@robexley](https://discourse.gohugo.io/u/robexley)\
**Post date:** [June 8, 2022, 6:52pm UTC](https://discourse.gohugo.io/t/ananke-theme-featured-images-not-displayed-when-baseurl-includes-subdirectory/38963/5 "2022-06-08T18:52:49Z")

</div>

Raised as issue #556 on Ananke theme GitHub repo.

> <https://github.com/theNewDynamic/gohugo-theme-ananke/issues/556>
>
> See the following post on Hugo discussion forum =\> https://discourse.gohugo.io/t…/ananke-theme-featured-images-not-displayed-when-baseurl-includes-subdirectory/38963
> 
> \--
> 
> 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

---

<div class="post-metadata">

**Author:** ![robexley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/robexley/32/17057_2.png) [@robexley](https://discourse.gohugo.io/u/robexley)\
**Post date:** [June 8, 2022, 7:18pm UTC](https://discourse.gohugo.io/t/ananke-theme-featured-images-not-displayed-when-baseurl-includes-subdirectory/38963/6 "2022-06-08T19:18:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cshoredaniel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cshoredaniel/32/19684_2.png) [@cshoredaniel](https://discourse.gohugo.io/u/cshoredaniel)\
**Post date:** [June 8, 2022, 8:58pm UTC](https://discourse.gohugo.io/t/ananke-theme-featured-images-not-displayed-when-baseurl-includes-subdirectory/38963/7 "2022-06-08T20:58:13Z")

</div>

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

> **[GitHub - danielfdickinson/dananke-theme-hugo-dfd: Highly modified version of...](https://github.com/danielfdickinson/dananke-theme-hugo-dfd)**
>
> Highly modified version of Ananke Hugo Theme. Contribute to danielfdickinson/dananke-theme-hugo-dfd development by creating an account on GitHub.

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

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 6, 2022, 9:54pm UTC](https://discourse.gohugo.io/t/ananke-theme-featured-images-not-displayed-when-baseurl-includes-subdirectory/38963/8 "2022-09-06T21:54:24Z")

</div>

A post was split to a new topic: [Featured image not working with Ananke theme](https://discourse.gohugo.io/t/featured-image-not-working-with-ananke-theme/40405)
