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

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.

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

Great solution, I’d tweak this slightly so that it works on your homepage:

<a href="{% if request.path == "/" %}
{{ request.full_url }}
{% else %}
{{ request.full_url|replace(request.path, '') }}
{% endif %}">
 <img class="logo">
</a>

Otherwise you would end up with mywebsite.com

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.

Hope this helps!

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