CMS Development

NPeters
投稿者

Hubl variable for website root url

解決

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件の承認済みベストアンサー
Teun
解決策
名誉エキスパート | Elite Partner
名誉エキスパート | Elite Partner

Hubl variable for website root url

解決

@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.


元の投稿で解決策を見る

webdew
解決策
ガイド役 | Platinum Partner
ガイド役 | Platinum Partner

Hubl variable for website root url

解決

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 いいね!
3件の返信
webdew
解決策
ガイド役 | Platinum Partner
ガイド役 | Platinum Partner

Hubl variable for website root url

解決

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 いいね!
Teun
名誉エキスパート | Elite Partner
名誉エキスパート | Elite Partner

Hubl variable for website root url

解決

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
解決策
名誉エキスパート | Elite Partner
名誉エキスパート | Elite Partner

Hubl variable for website root url

解決

@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.