CMS Development

MMcLellan
Participant

Module for Email Table with HREF not working with Link or URL Fields

SOLVE

Not sure what I'm going wrong, but I've got a simple HTML block module to create an event table that I want to drop into an email. I will re-use this with other marketers so wanted to create it as editable using fields. I created the field for the event date, name, and URL, and used those fields in the module but when I check my module preview -- the date and name work, but the href link just gives me an error each time, like its not pullin in the URL from the field I created?

 

CODE:

<table role="presentation" border="1" style width="90%" style="margin-left: auto; margin-right: auto">
<th style="width:40%">Date of Event</th>
<th style="width:50%">Event Name/Info</th>
<tr>
<td style="padding: 8px";>{{ module.event_1.event_1_date }}</td>
<td style="padding: 8px";><a href="{{ module.event_1.link_field }}">{{ module.event_1.event_1 }}</a></td>
</tr>
<tr>
<td style="padding: 8px";>Date 2</td>
<td style="padding: 8px";>Event with Link 2</td>
</tr>
<td style="padding: 8px";>Date 3</td>
<td style="padding: 8px";>Event with Link</td>
</table>

1 Accepted solution
amwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Module for Email Table with HREF not working with Link or URL Fields

SOLVE

If you're using the URL field then you would need to add .href to the end of the value to get the link.

module.event_1.link_field.href

 

If you're using the Link field you would add .url.href to the end of the value to get the link.

module.event_1.link_field.url.href

 

You can click the "Copy" dropdown inside a field and select "Copy Snippet" to get the exact snippet needed to render the field data.

 

copy-snippet.png

 

 

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developer at Lynton

Learn HubL | Get Marketing Insights

View solution in original post

3 Replies 3
MMcLellan
Participant

Module for Email Table with HREF not working with Link or URL Fields

SOLVE

Thank you, this helped me figure out that snippet piece I was editing wrong!

0 Upvotes
amwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Module for Email Table with HREF not working with Link or URL Fields

SOLVE

If you're using the URL field then you would need to add .href to the end of the value to get the link.

module.event_1.link_field.href

 

If you're using the Link field you would add .url.href to the end of the value to get the link.

module.event_1.link_field.url.href

 

You can click the "Copy" dropdown inside a field and select "Copy Snippet" to get the exact snippet needed to render the field data.

 

copy-snippet.png

 

 

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developer at Lynton

Learn HubL | Get Marketing Insights

TomM2
Key Advisor | Partner
Key Advisor | Partner

Module for Email Table with HREF not working with Link or URL Fields

SOLVE

Hey @MMcLellan It looks like you're using field values for the urls. "even_1.event_1_date" are pulling from these. Just to verify, do you have these fields set up on the right panel within the design manager?
If so, do the snippets you've added in here exactly match the titles within the fields you've set? 

 

If so, have you set a default value or a value for these fields? What is the output HTML you're seeing from this module? 

Tom Mahon tom@hub-spark.com
HubSpot Expert | Digital Marketing Specialist | Community Champion
HubSpark

Book a meeting

Did my post help answer your query? Help the community (and me) by marking it as a solution.