<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using HubL tags to change href in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Using-HubL-tags-to-change-href/m-p/528716#M26203</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a custom coded template and would like the user to be able to paste in a link which is used in a custom button.&amp;nbsp; I tried using the custom html HubL tags but they insert some extra elements which break the anchor tag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm trying to do:&lt;/P&gt;&lt;P&gt;&amp;lt;a style="text-decoration:none" href="{% raw_html "my_custom_html_module" label="Enter HTML here" value='&amp;lt;div&amp;gt;My HTML Block&amp;lt;/div&amp;gt;' %}"&amp;gt;&lt;/P&gt;&lt;P&gt;Custom Button Here&lt;/P&gt;&lt;P&gt;&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are there are any tags which also insertion of html without the extra attached code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;</description>
    <pubDate>Thu, 18 Nov 2021 23:11:57 GMT</pubDate>
    <dc:creator>PMarshTAC</dc:creator>
    <dc:date>2021-11-18T23:11:57Z</dc:date>
    <item>
      <title>Using HubL tags to change href</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-HubL-tags-to-change-href/m-p/528716#M26203</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a custom coded template and would like the user to be able to paste in a link which is used in a custom button.&amp;nbsp; I tried using the custom html HubL tags but they insert some extra elements which break the anchor tag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm trying to do:&lt;/P&gt;&lt;P&gt;&amp;lt;a style="text-decoration:none" href="{% raw_html "my_custom_html_module" label="Enter HTML here" value='&amp;lt;div&amp;gt;My HTML Block&amp;lt;/div&amp;gt;' %}"&amp;gt;&lt;/P&gt;&lt;P&gt;Custom Button Here&lt;/P&gt;&lt;P&gt;&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are there are any tags which also insertion of html without the extra attached code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 23:11:57 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-HubL-tags-to-change-href/m-p/528716#M26203</guid>
      <dc:creator>PMarshTAC</dc:creator>
      <dc:date>2021-11-18T23:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using HubL tags to change href</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-HubL-tags-to-change-href/m-p/528875#M26205</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/250223"&gt;@PMarshTAC&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to get it clear - when saying "user",you mean the "marketers" who are building the pages, right?&lt;/P&gt;
&lt;P&gt;The best way would be to create a custom module and place this custom module in your template. This will give you some advantages over "pure HTML" coded links.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Back to your question.&lt;/P&gt;
&lt;P&gt;You're on the right way.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to build a custom module(easy) you can do it like this:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;create a new custom module by right-click on the folder you'd like to have it placed&lt;/LI&gt;
&lt;LI&gt;click on "Add field" in the right sidebar and search/select "Link"&lt;/LI&gt;
&lt;LI&gt;give it a name or leave it as it is&lt;/LI&gt;
&lt;LI&gt;copy the whole snippet and place it in the HTML+Hubl part of the screen&lt;/LI&gt;
&lt;LI&gt;go to the overview in the right sidebar and add a "text" field (rich-text not recomended)&lt;/LI&gt;
&lt;LI&gt;give it a name (I'vce called mine "button label")&lt;/LI&gt;
&lt;LI&gt;Copy the value(the snippet would work too but I like to kepep the code cledan)&lt;/LI&gt;
&lt;LI&gt;replace the "Link text" text in the HTML+Hubl part with the copied value&lt;/LI&gt;
&lt;LI&gt;add your inline-styling or css classes to the &amp;lt;a&amp;gt;-tag&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The whole module should look like this&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anton_0-1637309832386.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/54177i2B9B7B48FDCC559E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anton_0-1637309832386.png" alt="Anton_0-1637309832386.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my code (unless you use the same labels it won't work)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set href = module.link_field.url.href %}
{% if module.link_field.url.type is equalto "EMAIL_ADDRESS" %}
	{% set href = "mailto:" + href %}
{% endif %}
&amp;lt;a href="{{ href }}" {% if module.link_field.open_in_new_tab %}target="_blank"{% endif %} {% if module.link_field.rel %}rel="{{ module.link_field.rel }}"{% endif %} style="text-decoration:none" class=""&amp;gt;
	{{ module.button_label }}
&amp;lt;/a&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are basicly no limitations how you can add classes (if you'd like to have all buttons look the same). You can either add another text field and use the value of it in the class="" area of the tag, you can predefine classes in a "select" option and place the value in the class="" area, you can add style-fields(new). What ever you'd like.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To place it in your template(s) you can scroll down in right sidebar, copy the whole snippet and paste it where you like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Code" links into templates is - imo - a very outdated technique because it will bloat the "page creation" layout and make it harder for the marketers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;best,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anton&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 08:27:23 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-HubL-tags-to-change-href/m-p/528875#M26205</guid>
      <dc:creator>Anton</dc:creator>
      <dc:date>2021-11-19T08:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using HubL tags to change href</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-HubL-tags-to-change-href/m-p/529203#M26212</link>
      <description>&lt;P&gt;Hi Anton, thanks for the input.&amp;nbsp; By users I mean marketers.&amp;nbsp; In our situation, I am doing the module and template development as well as updating the site.&amp;nbsp; Every now and then someone else will want to change some text if I'm not around though which is why I want everything to be editable.&amp;nbsp; I've made pages before with everything inside one of the custom html modules but then I'm the only one who knows how to update it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used your example and got it working.&amp;nbsp; The main reason I was shying away from a module is because I didn't want to create a module and only use it in one place.&amp;nbsp; I'm using flexbox and the way my css is set up, the module would probably only look right in the exact spot that I'm putting it.&amp;nbsp; But maybe that's the intention with custom coded templates anyway?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regardless, thanks for the help.&amp;nbsp; I'll be using this technique more in the future I'm sure.&lt;/P&gt;&lt;P&gt;-Peter&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 17:44:32 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-HubL-tags-to-change-href/m-p/529203#M26212</guid>
      <dc:creator>PMarshTAC</dc:creator>
      <dc:date>2021-11-19T17:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using HubL tags to change href</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Using-HubL-tags-to-change-href/m-p/529521#M26218</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/250223"&gt;@PMarshTAC&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;awesome!&lt;/P&gt;
&lt;P&gt;It's completly up to you how you "design" the custom modules.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the "old" days it was pretty common to build whole row custom modules with different columns and "sub modules".&lt;/P&gt;
&lt;P&gt;With the release of &lt;A href="https://developers.hubspot.com/docs/cms/building-blocks/themes" target="_blank" rel="noopener"&gt;drag&amp;amp;drop themes&lt;/A&gt; it's a much more flexible approach and should give the marketers the ability to build pages on their own. The developer should create &lt;A href="https://developers.hubspot.com/docs/cms/building-blocks/modules/files" target="_blank" rel="noopener"&gt;custom modules,&lt;/A&gt; &lt;A href="https://developers.hubspot.com/docs/cms/building-blocks/templates/drag-and-drop-areas/sections" target="_blank" rel="noopener"&gt;sections&lt;/A&gt;("predefined" rows with several modules) and &lt;A href="https://developers.hubspot.com/docs/cms/building-blocks/templates/drag-and-drop-areas" target="_blank" rel="noopener"&gt;drag and drop templates&lt;/A&gt; which can be completly edited by the "non-developer".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're planing to give it a try: a) start with the &lt;A href="https://github.com/HubSpot/cms-theme-boilerplate/tree/main/src/templates" target="_blank" rel="noopener"&gt;boilerplate&lt;/A&gt; "from scratch", or a cloned version of a &lt;A href="https://developers.hubspot.com/docs/cms/building-blocks/themes/default-themes" target="_blank" rel="noopener"&gt;default theme&lt;/A&gt;. But keep in mind that HubSpot is still using Bootstrap2 logic and will always add the coresponding classes. You can modify the grid to a flexbox logic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;best,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anton&lt;/P&gt;</description>
      <pubDate>Sat, 20 Nov 2021 17:11:23 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Using-HubL-tags-to-change-href/m-p/529521#M26218</guid>
      <dc:creator>Anton</dc:creator>
      <dc:date>2021-11-20T17:11:23Z</dc:date>
    </item>
  </channel>
</rss>

