# Section templates, context variables and theme images.

**URL:** <https://community.hubspot.com/t/section-templates-context-variables-and-theme-images/94610>\
**Category:** CMS Development\
**Created:** [November 22, 2023, 4:36pm UTC](https://community.hubspot.com/t/section-templates-context-variables-and-theme-images/94610 "2023-11-22T16:36:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisSequel](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@ChrisSequel](https://community.hubspot.com/u/ChrisSequel)\
**Post date:** [November 22, 2023, 4:36pm UTC](https://community.hubspot.com/t/section-templates-context-variables-and-theme-images/94610/1 "2023-11-22T16:36:13Z")

</div>

I have a page template referencing a section template and I am trying to use the context variable to change the default image shown for this section to another image in the theme.

Normally, in the template html, I would reference a theme image with

`get_asset_url("../images/theme-image.jpg")`

And in the section template

`img={ "src": context.image || get_asset_url("../images/another-image.jpg") }`

However, in the page template the following gives a template compilation error:

```lia-code-sample
{% include_dnd_partial path="../sections/custom-section.html" 
 context={image: get_asset_url("../images/theme-image.jpg") }
 %}

```

I’ve tried setting a variable to the asset url and assigning that to image. No error is generated but the image is ignored. E.g.

```lia-code-sample
{% set my_image = get_asset_url("../images/theme-image.jpg") %}
{% include_dnd_partial path='../sections/custom-section.html'
 context={
 image: my_image
 }
%}

```

What is the correct way to pass an image src value via the context variable to a section template?

---

<div class="post-metadata">

**Author:** ![Mike\_Eastwood](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mike_eastwood/32/70075_2.png) [@Mike\_Eastwood](https://community.hubspot.com/u/Mike_Eastwood)\
**Post date:** [November 22, 2023, 10:14pm UTC](https://community.hubspot.com/t/section-templates-context-variables-and-theme-images/94610/2 "2023-11-22T22:14:37Z")

</div>

Hi @ChrisSequel

 ![Screen Shot 2023-11-23 at 11.12.34 AM.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/b/a/ba5c1bdf4ef2ca4029922131f5b9d7826bac8f10.png)  
I haven’t tried your exact use case, but what I did is upload the default image to my theme and used an ablsolute URL. I got the URL by right clicking the image in the theme and select copy path.

In this example I get the path:

/TBR-theme-202311/images/hero/TBR-angela6-pink-tom9-yellow-1800x450px.jpg

Does that work for you?

Mike

Here to learn more about HubSpot and share my HubSpot Knowledge. I’m the founder of [Webalite](https://www.webalite.com?utm_campaign=community-forum&utm_source=community&utm_content=signature) a HubSpot Partner Agency based in Wellington, New Zealand and the founder of **Portal-iQ** the world’s first automated [HubSpot Portal Audit](https://portal-iq.com?utm_campaign=community-forum&utm_source=community-forum&utm_content=signature) that helps you work smarter with HubSpot.
