CMS Development

InciteJoe
Contributor | Gold Partner
Contributor | Gold Partner

Set button options at template level

SOLVE

I am creating a template that uses buttons that jump down to the form, the form section has an anchor id of "contact"

 

How can I set the button settings at template level to set the button options to "Use as link" then the button link to be #contact?

 

The below is my current button module settings

 

{% dnd_module
path="../modules/button",
button_text="Add button text"
%}

0 Upvotes
1 Accepted solution
BarryGrennan
Solution
Top Contributor

Set button options at template level

SOLVE

Just had a look at Session theme.

 

I think what you'll want to do is something like this:

{% dnd_module
path="../modules/button",
button_text="Add button text1",
button_options={"button_link_toggle": true},
button_link={"url":{"href":"#contact"}}
%}

profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact | LinkedIn

 

 

View solution in original post

9 Replies 9
BarryGrennan
Top Contributor

Set button options at template level

SOLVE

Thanks for the tag @Jaycee_Lewis!

 

Hi @InciteJoe, assuming your button module is from the boilerplate you'd do it like this:

 

 

  {% dnd_module
path="../modules/button",
button_text="Add button text",link={"url":{"href":"#contact"}}
    %} 

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact | LinkedIn

 

 

InciteJoe
Contributor | Gold Partner
Contributor | Gold Partner

Set button options at template level

SOLVE

Hi @BarryGrennan 

 

Sorry I just tried it using this

 

{% dnd_module
path="../modules/button",
button_text="Add button text1",
link={"url":{"href":"#contact"}}
%}

 

But the output I get from that is this

 

<button class="button" id="button_dnd_area-module-32" rel="">Add button text1</button>

0 Upvotes
BarryGrennan
Top Contributor

Set button options at template level

SOLVE

@InciteJoe it looks to me like that button module isn't from the boilerplate (at least the version I'm using) as the boilerplate outputs an anchor tag with a hs-button class rather than a button tag as yours does.

 

Can you post the content of the html area in your button module? It'll give me a clue to what the url field is called


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact | LinkedIn

 

 

0 Upvotes
InciteJoe
Contributor | Gold Partner
Contributor | Gold Partner

Set button options at template level

SOLVE

Sorry about that @BarryGrennan I am using the free Hubspot "Session theme" and I didn't realise that it has a modified button module

 

It looks like it has a field group called "button_options" then a field within this called with a field called "button_link_toggle" with is a Boolean and then it just has the field called "button_link" which is a link field 

0 Upvotes
BarryGrennan
Solution
Top Contributor

Set button options at template level

SOLVE

Just had a look at Session theme.

 

I think what you'll want to do is something like this:

{% dnd_module
path="../modules/button",
button_text="Add button text1",
button_options={"button_link_toggle": true},
button_link={"url":{"href":"#contact"}}
%}

profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact | LinkedIn

 

 

InciteJoe
Contributor | Gold Partner
Contributor | Gold Partner

Set button options at template level

SOLVE

Thanks @BarryGrennan that works perfectly!

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Set button options at template level

SOLVE

Hi, @InciteJoe, thanks for the question! One question for context, are you getting an error when trying your current approach? I am hoping we can help give the community more details to work with.

 

Hey, @BarryGrennan, do you have any tips you can share with @InciteJoe?

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

InciteJoe
Contributor | Gold Partner
Contributor | Gold Partner

Set button options at template level

SOLVE

Thanks @Jaycee_Lewis@BarryGrennan managed to help me

Jaycee_Lewis
Community Manager
Community Manager

Set button options at template level

SOLVE

That's great to know, @InciteJoe! Thank you, @BarryGrennan 🙌

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes