> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Introduction

## Article: Introduction

## Article Link: https://dev.wix.com/docs/sdk/site-sdk/pages-and-navigation/url/introduction.md

## Article Content:

# About the URL API

The URL API tells you the addresses that the site and its pages use. Use it to link to the site's pages and to respond to the address a site visitor arrives at, so your code keeps working when the site's domain or page paths change.

With the URL API, you can:

- Retrieve the full URL of the page a site visitor is on, including its query string.
- Retrieve the site root URL, to build absolute links that work on a custom domain and on a free Wix domain.
- Retrieve the URL of a page that an installed app adds to the site, such as the Bookings checkout, without hardcoding its path.

The service doesn't parse URLs or navigate. To read part of a URL, such as its path or a query parameter, use the standard [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) object. To navigate from your code, use `@wix/site-service-router`.

## Use cases

- [Build a link to a page owned by an app](https://dev.wix.com/docs/sdk/site-sdk/pages-and-navigation/url/sample-flows.md)
- [Link to an item on a router page owned by an app](https://dev.wix.com/docs/sdk/site-sdk/pages-and-navigation/url/sample-flows.md)
- [Read a query parameter from the current URL](https://dev.wix.com/docs/sdk/site-sdk/pages-and-navigation/url/sample-flows.md)

## Terminology

- **Site root URL**: The site's public base URL. On a free Wix domain it includes a path prefix, such as `https://example.wixsite.com/mysite`.
- **App page**: A page that an app installed on the site adds to it, such as the Bookings checkout page. Its app page ID stays the same across sites, even though a Wix user can change the page's path.
- **Router page**: A page whose path combines a fixed prefix with a per-item suffix, such as `/News/spring-sale`. Here the prefix is `/News` and the suffix varies per item.
- **Router prefix**: The fixed leading part of a router page's path.
- **Popup**: A page that opens over the page a visitor is already on, rather than replacing it.

## SDK setup

@package_metadata:@wix/site-service-url

To use the API, install the `@wix/site-service-url` package:

```bash
npm install @wix/site-service-url
```

#### Import the package

```ts
import { UrlDefinition } from '@wix/site-service-url/definition'
```

#### Resolve the service

In a React component, resolve the service with the `useService` hook:

```tsx
import { useService } from '@wix/services-manager-react'
import { UrlDefinition } from '@wix/site-service-url/definition'

function SiteHeader() {
    const urlService = useService(UrlDefinition)

    return <a href={urlService.siteUrl}>Home</a>
}
```