Nuxt Hooks

Learn how to use Nuxt hooks to modify your Schema.org output.

'schema-org:meta'

Type: async (config: ModuleOptions) => void | Promise<void>

You can hook into the generation of the meta-data used to generate the Schema.org data.

For example, this can be useful for dynamically changing the host.

my-nuxt-plugin.ts
import { defineNuxtPlugin } from '#app'

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hooks.hook('schema-org:meta', (meta) => {
    if (nuxtApp._route.path === '/plugin-override') {
      meta.host = 'https://override-example.com'
      meta.url = `${meta.host}${meta.path}`
    }
  })
})
Did this page help you?