# Hubl variable for website root url

**URL:** <https://community.hubspot.com/t/hubl-variable-for-website-root-url/41353>\
**Category:** CMS Development\
**Created:** [July 27, 2021, 1:57pm UTC](https://community.hubspot.com/t/hubl-variable-for-website-root-url/41353 "2021-07-27T13:57:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![NPeters](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/npeters/32/5125_2.png) [@NPeters](https://community.hubspot.com/u/NPeters)\
**Post date:** [July 27, 2021, 1:57pm UTC](https://community.hubspot.com/t/hubl-variable-for-website-root-url/41353/1 "2021-07-27T13:57:55Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [July 27, 2021, 2:29pm UTC](https://community.hubspot.com/t/hubl-variable-for-website-root-url/41353/2 "2021-07-27T14:29:32Z")

</div>

Hi @NPeters , you could try using **company\_domain** as described in the [documentation](https://developers.hubspot.com/docs/cms/hubl/variables#variables-available-in-all-templates). 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.

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [July 27, 2021, 2:41pm UTC](https://community.hubspot.com/t/hubl-variable-for-website-root-url/41353/3 "2021-07-27T14:41:26Z")

</div>

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

```lia-code-sample
<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>

```

---

<div class="post-metadata">

**Author:** ![gunnarnormand](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/gunnarnormand/32/6363_2.png) [@gunnarnormand](https://community.hubspot.com/u/gunnarnormand)\
**Post date:** [December 8, 2025, 10:02pm UTC](https://community.hubspot.com/t/hubl-variable-for-website-root-url/41353/4 "2025-12-08T22:02:09Z")

</div>

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

```lia-code-sample
<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](http://www.mywebsite.com/mywebsite.com)

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [July 28, 2021, 1:42pm UTC](https://community.hubspot.com/t/hubl-variable-for-website-root-url/41353/5 "2021-07-28T13:42:50Z")

</div>

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.

> **[Default web modules - HubSpot docs](https://developers.hubspot.com/docs/cms/reference/modules/default-modules)**
>
> Learn about the default modules that HubSpot provides for creating website page, blog post, and blog listing templates. These modules are separate from default email modules, which are for email templates.

Hope this helps!

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