# ApplicationRoot

{% hint style="info" %}
The `ApplicationRoot` keyword is used to retrieve a <mark style="color:green;">text</mark> value that contains the URL root-path of the portal.&#x20;

Mainly useful for the preview as that includes the portal-id in the url.

This function is SQL compatible. For more information about SQL compatibility, see our [documentation](https://docs.wem.io/platform/wemreference/sql-compatibility).
{% endhint %}

{% hint style="success" %}
Returns a text value containing the root-path of the application (excludes the hostname).

In Preview, it will yield the portal-id like "/{portal-id}"\
In Staging/Live runtimes, it will yield an empty string.

Combined with the function HostName() you can create a deeplink to a certain navigation item by its Path Name that will work in Preview (having the portal-id) as well as in Staging and Live
{% endhint %}

### Syntax

<details>

<summary><code>ApplicationRoot</code></summary>

In Preview, your application will show <https://preview.wem.io/{portal-id}?sv={session}\\>
`ApplicationRoot`\
\&#xNAN;*=> "/123456" where 123456 is your portal id.*&#x20;

`hostname() + applicationroot + "/path-to-navigationitem"`\
\&#xNAN;*=> "preview\.wem.io/123456/path-to-navigationitem" on Preview*\
*=> "portalname.staging.wem.io/path-to-navigationitem" on Staging*\
*=> "portalname.live.wem.io/path-to-navigationitem" on Live*

</details>

##
