# Hubl Variable Question

**URL:** <https://community.hubspot.com/t/hubl-variable-question/42830>\
**Category:** CMS Development\
**Created:** [August 24, 2021, 10:52pm UTC](https://community.hubspot.com/t/hubl-variable-question/42830 "2021-08-24T22:52:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RastaMan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rastaman/32/14727_2.png) [@RastaMan](https://community.hubspot.com/u/RastaMan)\
**Post date:** [August 24, 2021, 10:52pm UTC](https://community.hubspot.com/t/hubl-variable-question/42830/1 "2021-08-24T22:52:29Z")

</div>

This is a basic question, but I came across the following code in ‘hero-banner.html’ of the boilerplate theme and am unclear what 'context. ’ is referring to in the OR conditional. It looks like ‘context.image\_alt’ is a placeholder reference to a Hubl variable, correct? So just plug in your own variable assigned to image\_alt in fields.json, right?

{% dnd\_module  
path=‘@hubspot/linked\_image’,  
img={  
‘alt’:

**context.image\_alt**

|| ‘Stock placeholder image with grayscale geometrical mountain landscape’, …

---

<div class="post-metadata">

**Author:** ![Indra](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/indra/32/98381_2.png) [@Indra](https://community.hubspot.com/u/Indra)\
**Post date:** [August 25, 2021, 6:21am UTC](https://community.hubspot.com/t/hubl-variable-question/42830/2 "2021-08-25T06:21:44Z")

</div>

Hi @RastaMan,

The OR conditional is used if there is nog alt tag assigned. So it’s the other way around and is used as a fallback.

So if `context.image_alt` is empty, set ‘Stock placeholder image with grayscale geometrical mountain landscape’.

The `OR` or `||` is usefull in other ways if for example you create a custom module to create a card. So when the user has to set an title, description and image. the title and description fields are required, but the image is not. But to make your front-end more consistent it’s nice to display a placeholder image. So then you will get something like this:

```lia-code-sample
{# Set variable for card and add placeholder for image and image alt #}
{% set title = module.title %}
{% set description = module.description %}
{% set image_src=module.image.src || 'https://www.sample.com/images/placeholder.jpg' %}
{% set image_alt = module.image.alt || 'Example image' %}

{# Card element #}
<div class="card">
 <img src="{{ image_src }}" alt="{{ image_alt }}" />
 <h2 class="card__title">{{ title }}</h2>
 <div class="card__description">{{ title }}</div>
</div>

```

So instead of doing an if statement to check if your image exists it is set to make your HTML more readable.

```lia-code-sample
{# Set variable for card and add placeholder for image and image alt #}
{% set title = module.title %}
{% set description = module.description %}
{% set image_src=module.image.src %}
{% set image_alt = module.image.alt %}

{# Card element #}
<div class="card">
 {% if image_src %}<img src="{{ image_src }}" alt="{{ image_alt }}" />
 {% else %}
 {% if image_src %}<img src="https://www.sample.com/images/placeholder.jpg" alt="Example image" />
 {% endif %}
 <h2 class="card__title">{{ title }}</h2>
 <div class="card__description">{{ title }}</div>
</div>

```

---

<div class="post-metadata">

**Author:** ![RastaMan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rastaman/32/14727_2.png) [@RastaMan](https://community.hubspot.com/u/RastaMan)\
**Post date:** [August 25, 2021, 11:24pm UTC](https://community.hubspot.com/t/hubl-variable-question/42830/3 "2021-08-25T23:24:08Z")

</div>

Hi @Indra , thank you for your response, it is quite helpful and answers my question completely.

-- RM
