APIs & Integrations

BenMIN
Member

Help with Link Fields in Custom Module

SOLVE

Hi,

I'm trying to add a link field to a custom module like this: https://designers.hubspot.com/blog/url-and-link-fields-now-available-in-custom-modules

When I do this and click the "read more" link it just takes me back to the same page the module is on.

I have made a link field HubL variable called "link_field" 

<div class="uilink" {{module.link_field.href}} >
{% set href = module.link_field.url.href %}
{% if module.link_field.url.type is equalto "EMAIL_ADDRESS" %}
{% set href = "mailto:" + href %}
{% endif %}
<a href="{{ href }}"
{% if module.link_field.open_in_new_tab %}target="_blank"{% endif %}
{% if module.link_field.no_follow %}rel="nofollow"{% endif %}>
Read more</a>
</div>

Not sure what I'm doing wrong here?

Thanks!

0 Upvotes
1 Accepted solution
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Help with Link Fields in Custom Module

SOLVE

Hi @BenMIN,

 

Are you linking to an external site? If so, did you indicate the correct external link?

 

On my end, I set up a custom module to add link field like this:

Screen Shot 2019-11-07 at 12.41.43 PM.png

 

Add the module on my page: https://info.wendyggx.com/landing-page/fuji-yoga > When I click on the 'Read More' link > I was directed to google.com just fine.

 

Do our set up match? Let me know if I'm missing anything here.

View solution in original post

0 Upvotes
2 Replies 2
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Help with Link Fields in Custom Module

SOLVE

Hi @BenMIN,

 

Are you linking to an external site? If so, did you indicate the correct external link?

 

On my end, I set up a custom module to add link field like this:

Screen Shot 2019-11-07 at 12.41.43 PM.png

 

Add the module on my page: https://info.wendyggx.com/landing-page/fuji-yoga > When I click on the 'Read More' link > I was directed to google.com just fine.

 

Do our set up match? Let me know if I'm missing anything here.

0 Upvotes
BenMIN
Member

Help with Link Fields in Custom Module

SOLVE

Hi Wendy,

 

Thanks for your help! I realised I had a typo in the field. I've got it working now.

 

Thanks!

 

0 Upvotes