CMS Development

tezrosolutions
Member

Accessing custom text field in my HubSpot blog listing HuBL markup

SOLVE

I added a custom text field in my HubSpot blog post template, how can I access it in the blog listing HuBL markup?

0 Upvotes
1 Accepted solution
Ty
Solution
HubSpot Employee
HubSpot Employee

Accessing custom text field in my HubSpot blog listing HuBL markup

SOLVE

Hi @tezrosolutions,

 

In HubL, if you created your text field with markup that looks like this:

{% text "your_custom_modulefield" label="Your custom moudule field", export_to_template_context=True %}

Then when you go to reference it, you have 2 options, referencing into the POST, or referencing into the LISTING

 

Into the Post: 

{{ widget_data.your_custom_modulefield.value }}

Into the Listing:

{{ content.widgets.your_custom_modulefield.body.value }}

The difference of the two is when you're calling from outside the file where you actually made it (made in POST) you have to reference it as "content.widgets" and then reference it's value with "body.value".

More on referencing modules can be found here as well.

 

Hope this helps you out, let me know if you have any other questions!

-- Ty

 

 

View solution in original post

0 Upvotes
2 Replies 2
Ty
Solution
HubSpot Employee
HubSpot Employee

Accessing custom text field in my HubSpot blog listing HuBL markup

SOLVE

Hi @tezrosolutions,

 

In HubL, if you created your text field with markup that looks like this:

{% text "your_custom_modulefield" label="Your custom moudule field", export_to_template_context=True %}

Then when you go to reference it, you have 2 options, referencing into the POST, or referencing into the LISTING

 

Into the Post: 

{{ widget_data.your_custom_modulefield.value }}

Into the Listing:

{{ content.widgets.your_custom_modulefield.body.value }}

The difference of the two is when you're calling from outside the file where you actually made it (made in POST) you have to reference it as "content.widgets" and then reference it's value with "body.value".

More on referencing modules can be found here as well.

 

Hope this helps you out, let me know if you have any other questions!

-- Ty

 

 

0 Upvotes
amin9
Participant

Accessing custom text field in my HubSpot blog listing HuBL markup

SOLVE

@Ty 

Is this code applicable now, or backdated?

0 Upvotes