CMS Development

NPeters
Mitwirkender/Mitwirkende

Hubl variable for website root url

lösung

I have a header that contains a logo that when clicked takes you to the homepage.

 

The homepage is a root url ie http://www.mywebsite.com

 

I had expected as with other CMSs that there would a simple variable like {{ site_url }}

 

I have looked at the variable docs. There appears to be nothing. I had tried {{ group.absolute_url }} nothing as expected.

 

I would rather not hardcode the value.

 

What is the correct HubL way to achieve this.

 

Thanks

2 Akzeptierte Lösungen
Teun
Lösung
Trendsetter/-in | Elite Partner
Trendsetter/-in | Elite Partner

Hubl variable for website root url

lösung

@NPeters I created a quick snippet to try. When using request.full_url combined with request.path you could retrieve the domain URL:

<section class="o-container">
  <br /><strong>request.full_url:</strong> {{request.full_url}}<br />
  <strong>request.path:</strong> {{request.path}}<br />
  <strong>filtered url:</strong> {{request.full_url|replace(request.path, '')}}
</section>

 



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


Lösung in ursprünglichem Beitrag anzeigen

webdew
Lösung
Ratgeber/-in | Platinum Partner
Ratgeber/-in | Platinum Partner

Hubl variable for website root url

lösung

Hi @NPeters ,

In the Hubspot module, we have the option for logo settings. you can use this module on your website. and can change the logo redirections and set the default also.

https://developers.hubspot.com/docs/cms/building-blocks/modules/default-modules


Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards. 

Lösung in ursprünglichem Beitrag anzeigen

0 Upvotes
3 Antworten
webdew
Lösung
Ratgeber/-in | Platinum Partner
Ratgeber/-in | Platinum Partner

Hubl variable for website root url

lösung

Hi @NPeters ,

In the Hubspot module, we have the option for logo settings. you can use this module on your website. and can change the logo redirections and set the default also.

https://developers.hubspot.com/docs/cms/building-blocks/modules/default-modules


Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards. 

0 Upvotes
Teun
Trendsetter/-in | Elite Partner
Trendsetter/-in | Elite Partner

Hubl variable for website root url

lösung

Hi @NPeters , you could try using company_domain as described in the documentation. It prints the value set in Website > Pages > Branding > Logo Link.
If that does not give the expected result, you could use group.absolute_url or content.absolute_url and use a filter to strip everything after the domain URL.

What is the usecase for retrieving the homepage URL? You could also use a link field in a global module and set it to the homepage. This is what we do for all the headers we create that include the logo of the website.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


Teun
Lösung
Trendsetter/-in | Elite Partner
Trendsetter/-in | Elite Partner

Hubl variable for website root url

lösung

@NPeters I created a quick snippet to try. When using request.full_url combined with request.path you could retrieve the domain URL:

<section class="o-container">
  <br /><strong>request.full_url:</strong> {{request.full_url}}<br />
  <strong>request.path:</strong> {{request.path}}<br />
  <strong>filtered url:</strong> {{request.full_url|replace(request.path, '')}}
</section>

 



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.