Star
1.1K

createSitePathResolver()

Create a function to resolve a path relative to the site within Nitro.
Nuxt SEO Pro
  • Nuxt Redirects
  • Nuxt Google Search Console
  • Nuxt Internal Links
  • Nuxt SEO Analyze
Save $170 on the presale now.

Same as createSitePathResolver() but you will need to provide the request context.

Usage

serverMiddleware.ts
import { createSitePathResolver } from '#imports'

export default defineEventHandler((e) => {
  const resolvePath = createSitePathResolver(e, {
    canonical: true,
  })

  resolvePath('/about')
  // https://www.example.com/about
})
Did this page help you?