Index of every page on this site: llms.txt

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>.

import { createSitePathResolver } from '#site-config/app'

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.

absolute

  • Type: boolean
  • Default: false

Whether to resolve the path to an absolute URL.

withBase

  • Type: boolean
  • Default: false

Whether to include the base URL from the Nuxt app config.

Was this page helpful?