Site Config
Api
createSitePathResolver()
Create a function to resolve a path relative to the site.
A utility function to resolve a path in a number of ways while taking into account the url
, trailingSlash
and baseURL
config.
Usage
import { createSitePathResolver } from '#imports'
const resolvePath = createSitePathResolver({
canonical: true,
})
resolvePath('/about')
// https://www.example.com/about
API
canonical
- Type:
boolean
- Default:
true
Should the path be resolved to the canonical URL using the site config url
.
When false, it will resolve to the request host using useNitroOrigin.
absolute
- Type:
boolean
- Default:
false
Should the path be resolved to an absolute URL.
withBase
- Type:
boolean
- Default:
false