# Trouble Getting Links on Logo Grid Module

**URL:** <https://community.hubspot.com/t/trouble-getting-links-on-logo-grid-module/101885>\
**Category:** CMS Development\
**Tags:** free\
**Created:** [March 6, 2024, 4:45pm UTC](https://community.hubspot.com/t/trouble-getting-links-on-logo-grid-module/101885 "2024-03-06T16:45:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![babs](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@babs](https://community.hubspot.com/u/babs)\
**Post date:** [March 6, 2024, 4:45pm UTC](https://community.hubspot.com/t/trouble-getting-links-on-logo-grid-module/101885/1 "2024-03-06T16:45:24Z")

</div>

Hello HubSpot Developer Community, hoping for a learning experience for this newbie…

The default module Logo Grid (theme Brightlane) doesn’t let you add URL links to the logos. I’m trying to add in the code to do this and I can’t get it to work.

Here’s the original code:

{% set logos = module.group\_logos %}  
{% set grid\_settings = module.styles.group\_logo\_grid %}  
{% set logo\_styles = module.styles.group\_logo %}  
{% set grid\_basis\_spacing = grid\_settings.grid\_gap - (grid\_settings.grid\_gap / grid\_settings.column\_count) %}  
{% set column\_count\_percentage = ((1 / grid\_settings.column\_count) \* 100) ~ “%” %}

{% macro add\_style\_if\_value(style, field, unit = “”) %}  
{% set field\_with\_unit = field ~ unit %}  
{{ style }}: {{ field\_with\_unit }};  
{% endmacro %}

{% require\_css %}

\<style\>

@Layer module {  
{% scope\_css %}  
.hs-logo-grid {  
gap: {{ grid\_settings.grid\_gap ~ “px” }};  
}  
.hs-logo-grid\_\_logo-wrapper {  
flex: 0 1 calc({{ column\_count\_percentage }} - {{ grid\_basis\_spacing ~ “px” }});  
max-width: calc({{ column\_count\_percentage }} - {{ grid\_basis\_spacing ~ “px” }});  
{{ add\_style\_if\_value(“aspect-ratio”, logo\_styles.group\_background.aspect\_ratio) }}  
{{ add\_style\_if\_value(“background-color”, logo\_styles.group\_background.background\_color.css ) }}  
{{ logo\_styles.group\_spacing.padding.css }}  
}  
.hs-logo-grid\_\_logo {  
max-height: {{ logo\_styles.max\_logo\_height ~ “px” }};  
}  
{% end\_scope\_css %}  
}  
\</style\>

{% end\_require\_css %}

{% macro build\_image(image) %}  
{% if image.src %}  
{% set sizeAttrs = ‘width=“{{ image.width }}” height=“{{ image.height }}”’ %}  
{% set loadingAttr = image.loading != ‘disabled’ ? ‘loading=“{{ image.loading }}”’ : ‘’ %}  
\<img class=“hs-logo-grid\_\_logo” src=“{{ image.src }}” alt=“{{ image.alt }}” {{ loadingAttr }} {{ sizeAttrs }}\>  
{% endif %}  
{% endmacro %}

{% macro build\_logo\_grid() %}  
{% for item in logos %}  
\<div class=“hs-logo-grid\_\_logo-wrapper”\>  
{{ build\_image(item.logo) }}  
\</div\>

{% endfor %}  
{% endmacro %}

\<div class=“hs-logo-grid”\>  
{{ build\_logo\_grid() }}  
\</div\>

---

I added in the new Link Field variable already ‘link\_url’. With options to link to External/Content/File/Blog/etc.

When I tried adding in a href into the build\_image it didn’t work as I expected.

Can someone help me get my new field referenced within the HTML so it actually does something?

---

<div class="post-metadata">

**Author:** ![albertsg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/albertsg/32/99473_2.png) [@albertsg](https://community.hubspot.com/u/albertsg)\
**Post date:** [March 6, 2024, 5:18pm UTC](https://community.hubspot.com/t/trouble-getting-links-on-logo-grid-module/101885/2 "2024-03-06T17:18:50Z")

</div>

Hello @babs!  
You will need to wrap the elements you want to make clickable in an \<a\> tag.

You could add it inside the \<div class=“hs-logo-grid”\> or just turn that \<div\> into an \<a\> tag but preserving the class to avoid issues with styles.

You might still need to add certain CSS as \<a\> tags might have already predefined styles in your theme.

Then, make sure the \<a\> tag includes your field variable, something like this:

```lia-code-sample
<a href="{{module.link.url.href}}" class="hs-logo-grid">
 {{ build_logo_grid() }}
</a>

```

Hope this helps!

---

<div class="post-metadata">

**Author:** ![babs](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@babs](https://community.hubspot.com/u/babs)\
**Post date:** [March 6, 2024, 6:26pm UTC](https://community.hubspot.com/t/trouble-getting-links-on-logo-grid-module/101885/3 "2024-03-06T18:26:21Z")

</div>

Thank you so much for the quick response. It sounds so easy, but I must be entering the variable incorrectly, because when I use the module, the URL just links back to the page the module is on. It’s not pulling the URL I enter. I feel like I’ve tried every variation to get it to link. Anything else you can advise on to get me there?

 ![babs_0-1709749508919.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/9/c/9ce88d24cc7492747cc985c852c757e7dc31a27d.png)

---

<div class="post-metadata">

**Author:** ![albertsg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/albertsg/32/99473_2.png) [@albertsg](https://community.hubspot.com/u/albertsg)\
**Post date:** [March 7, 2024, 8:58pm UTC](https://community.hubspot.com/t/trouble-getting-links-on-logo-grid-module/101885/4 "2024-03-07T20:58:03Z")

</div>

I realize I made a typo on the code I sent you before, I was copying & pasting something from one of my modules and didn’t update the variable name.

The code below should work based on your variables:

```lia-code-sample
<a href="{{item.link_url.url.href}}" class="hs-logo-grid__logo-wrapper">
{{ build_image(item.logo) }}
</a>

```

Let me know if that works!

---

<div class="post-metadata">

**Author:** ![babs](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@babs](https://community.hubspot.com/u/babs)\
**Post date:** [March 11, 2024, 12:34pm UTC](https://community.hubspot.com/t/trouble-getting-links-on-logo-grid-module/101885/5 "2024-03-11T12:34:48Z")

</div>

Thanks!! That did the trick, just needed to revise some CSS and all is working. Appreciate it!
