---
title: "createSitePathResolver()"
description: "Create a function to resolve a path relative to the site."
canonical_url: "https://nuxtseo.com/docs/site-config/api/create-site-path-resolver"
last_updated: "2026-05-11T19:37:28.259Z"
---

A utility function to resolve a path in a number of ways while taking into account the `url`, `trailingSlash` and `baseURL`
config.

## Usage

The returned resolver accepts a `MaybeRef<string>` and returns a computed `Ref<string>`.

```ts
import { createSitePathResolver } from '#imports'

const resolvePath = createSitePathResolver({
  canonical: true,
})

const aboutUrl = resolvePath('/about')
// aboutUrl.value === 'https://www.example.com/about'
```

## API

### `canonical`

- Type: `boolean`
- Default: `true`

Whether to resolve the path to the canonical URL using the site config `url`.

When false, it will resolve to the request host using [getNitroOrigin](/docs/site-config/api/get-nitro-origin).

### `absolute`

- Type: `boolean`
- Default: `false`

Whether to resolve the path to an absolute URL.

### `withBase`

- Type: `boolean`
- Default: `false`

Should the path include the base URL from the Nuxt app config.
