Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
defineNuxtConfig
✓ import { defineNuxtConfig } from 'nuxt'
✗ const defineNuxtConfig = require('nuxt').defineNuxtConfig
Used for configuring the Nuxt module in nuxt.config.ts. Nuxt 3 projects primarily use ESM.
useSchemaOrg
✓ import { useSchemaOrg } from '#imports'
✗ import { useSchemaOrg } from 'nuxt-schema-org'
This is a Nuxt composable; always import from '#imports' within Nuxt components or plugins for correct auto-import resolution.
defineWebSite
✓ import { defineWebSite } from '#imports'
✗ import { defineWebSite } from 'nuxt-schema-org'
Schema node definitions are composables and should be imported from '#imports'.
SchemaOrgOrganization
✓ import { SchemaOrgOrganization } from '#imports'
✗ import { SchemaOrgOrganization } from 'nuxt-schema-org'
Schema node definitions can also be imported as components from '#imports' for use directly in templates.
This quickstart demonstrates how to install `nuxt-schema-org`, configure it in `nuxt.config.ts` with a `host`, and then use `useSchemaOrg` within a Vue component to define `WebSite`, `WebPage`, and `Organization` schema nodes. It highlights the use of composables imported from `#imports`.
/* nuxt.config.ts */
import { defineNuxtConfig } from 'nuxt';
export default defineNuxtConfig({
modules: [
'nuxt-schema-org' // Add the module to your Nuxt configuration
],
schemaOrg: {
host: 'https://your-domain.com' // Crucial for generating correct '@id' URLs
}
});
/* pages/index.vue */
<template>
<div>
<h1>Welcome to My Awesome Nuxt App</h1>
<p>We generate powerful Schema.org data for SEO.</p>
</div>
</template>
<script setup lang="ts">
import { useSchemaOrg, defineWebSite, defineWebPage, defineOrganization } from '#imports';
// Define multiple Schema.org nodes for the current page
useSchemaOrg([
defineWebSite({
name: 'My Awesome Nuxt Site',
url: 'https://your-domain.com',
description: 'A comprehensive website built with Nuxt.',
inLanguage: 'en-US'
}),
defineWebPage({
name: 'Homepage',
url: 'https://your-domain.com/',
description: 'The main landing page of our Nuxt application.'
}),
defineOrganization({
name: 'Nuxt Solutions Inc.',
url: 'https://your-domain.com',
logo: 'https://your-domain.com/logo.png',
sameAs: [
'https://twitter.com/nuxt_solutions',
'https://linkedin.com/company/nuxt-solutions'
]
})
]);
// You can also add schema directly in your template using components
// <template>
// <SchemaOrgProduct name="My Product" description="A great product" />
// </template>
</script>
Errors
Common errors & fixes
SSR memory leaks observed when generating Schema.org graphs.
Older versions of nuxt-schema-org had issues with SSR memory management.
fixUpgrade to nuxt-schema-org version 6.0.0 or higher, as this issue was specifically addressed and resolved in this major release.
Incorrect or incomplete '@id' URL generation within Schema.org output.
Prior to v6.0.0, there were known issues with how '@id' URLs were resolved and generated, especially in complex scenarios.
fixEnsure you are running nuxt-schema-org v6.0.0 or later. Additionally, always explicitly set the `host` property in your `schemaOrg` configuration within `nuxt.config.ts` (e.g., `host: 'https://your-domain.com'`).
Schema.org JSON-LD not appearing in the page's HTML output.
The `nuxt-schema-org` module is not correctly registered or enabled in your Nuxt project.
fixVerify that `nuxt-schema-org` is included in the `modules` array of your `nuxt.config.ts` file: `modules: ['nuxt-schema-org']`.
Audit
Dependencies
@unhead/vuerequiredUsed for managing document head tags, where Schema.org JSON-LD is injected.
unheadrequiredCore head management library used by Nuxt and @unhead/vue.
zodoptionalOptional peer dependency for content schema validation and augmentation.