diff --git a/src/runtime/nitro/routes/__schema-org__/debug.ts b/src/runtime/nitro/routes/__schema-org__/debug.ts index a704394..6fbae3b 100644 --- a/src/runtime/nitro/routes/__schema-org__/debug.ts +++ b/src/runtime/nitro/routes/__schema-org__/debug.ts @@ -3,7 +3,8 @@ import type { ModuleRuntimeConfig } from '../../../types' import { useNitroOrigin, useRuntimeConfig } from '#imports' export default defineEventHandler(async (e) => { - const runtimeConfig = (useRuntimeConfig()['nuxt-schema-org'] || useRuntimeConfig().public['nuxt-schema-org']) as any as ModuleRuntimeConfig + const _config = useRuntimeConfig() + const runtimeConfig = (import.meta.client ? _config.public['nuxt-schema-org'] : (_config['nuxt-schema-org'] || _config.public['nuxt-schema-org'])) as any as ModuleRuntimeConfig const nitroOrigin = useNitroOrigin(e) return { nitroOrigin, diff --git a/src/runtime/nuxt/imports/useSchemaOrg.ts b/src/runtime/nuxt/imports/useSchemaOrg.ts index 65487d5..bc693d6 100644 --- a/src/runtime/nuxt/imports/useSchemaOrg.ts +++ b/src/runtime/nuxt/imports/useSchemaOrg.ts @@ -5,7 +5,8 @@ import { useHead, useRuntimeConfig, useServerHead } from '#imports' type Input = Parameters[0] export function useSchemaOrg(input: T): ActiveHeadEntry> | void { - const config = (useRuntimeConfig()['nuxt-schema-org'] || useRuntimeConfig().public['nuxt-schema-org']) as ModuleRuntimeConfig + const _config = useRuntimeConfig() + const config = (import.meta.client ? _config.public['nuxt-schema-org'] : (_config['nuxt-schema-org'] || _config.public['nuxt-schema-org'])) as ModuleRuntimeConfig const script = { type: 'application/ld+json', key: 'schema-org-graph', diff --git a/src/runtime/nuxt/plugin/defaults.ts b/src/runtime/nuxt/plugin/defaults.ts index c62a109..d5fe20d 100644 --- a/src/runtime/nuxt/plugin/defaults.ts +++ b/src/runtime/nuxt/plugin/defaults.ts @@ -14,7 +14,8 @@ import { export default defineNuxtPlugin({ name: 'nuxt-schema-org:defaults', setup() { - const runtimeConfig = useRuntimeConfig()['nuxt-schema-org'] || useRuntimeConfig().public['nuxt-schema-org'] + const _config = useRuntimeConfig() + const runtimeConfig = import.meta.client ? _config.public['nuxt-schema-org'] : (_config['nuxt-schema-org'] || _config.public['nuxt-schema-org']) // get the head instance const siteConfig = useSiteConfig() diff --git a/src/runtime/nuxt/plugin/init.ts b/src/runtime/nuxt/plugin/init.ts index 16cf6e4..e36fc65 100644 --- a/src/runtime/nuxt/plugin/init.ts +++ b/src/runtime/nuxt/plugin/init.ts @@ -10,7 +10,8 @@ export default defineNuxtPlugin({ enforce: 'post', setup(nuxtApp) { const head = injectHead() - const config = (useRuntimeConfig()['nuxt-schema-org'] || useRuntimeConfig().public['nuxt-schema-org']) as ModuleRuntimeConfig + const _config = useRuntimeConfig() + const config = (import.meta.client ? _config.public['nuxt-schema-org'] : (_config['nuxt-schema-org'] || _config.public['nuxt-schema-org'])) as ModuleRuntimeConfig const route = useRoute() const siteConfig = useSiteConfig()