Nuxt API
createSitePathResolver()
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 getNitroOrigin.
absolute
- Type:
boolean - Default:
false
Should the path be resolved to an absolute URL.
withBase
- Type:
boolean - Default:
false
Should the path include the base URL from the Nuxt app config.
Did this page help you?