X Enterprises

nuxt-x-schema

Schema.org structured data layer for Nuxt — 16 renderless JSON-LD components injected via useHead for SSR-safe rich snippet markup.

nuxt-x-schema

16 renderless Schema.org structured data components for Nuxt 4. Each component injects a <script type="application/ld+json"> tag into <head> via useHead — fully SSR-safe, visible to search engine crawlers on first paint.

Installation

npm install @xenterprises/nuxt-x-schema
// nuxt.config.ts
export default defineNuxtConfig({
  extends: ["@xenterprises/nuxt-x-schema"],
});

What This Layer Provides

  • 16 Schema.org components — all renderless, all auto-imported
  • useSchema() composable — shared utilities for URL resolution and JSON-LD injection

Configuration (app.config.ts)

export default defineAppConfig({
  xSchema: {
    siteUrl: "https://mysite.com",
    siteName: "My Site",
    siteLogo: "/logo.png",
    organizationName: "My Company",
  },
});
OptionTypeDefaultDescription
siteUrlstring"https://example.com"Base URL for absolute URL construction.
siteNamestring"My Website"Default organization/publisher name.
siteLogostring"/logo.png"Logo URL.
organizationNamestring""Organization name (falls back to siteName).

Components

XSchemaArticle — Blog posts, news articles

PropTypeRequiredDescription
headlinestringYesArticle title.
datePublishedstringYesISO 8601 publication date.
authorstring | Person | ArrayYesAuthor name(s) or Person object(s).
descriptionstringNoArticle summary.
imagestring | string[]NoArticle image URL(s).
dateModifiedstringNoLast modification date (defaults to datePublished).
articleTypestringNoArticle, BlogPosting, NewsArticle, TechArticle (default: "BlogPosting").
urlstringNoCanonical URL.
wordCountnumberNoWord count.

XSchemaBreadcrumb — Navigation breadcrumbs

PropTypeRequiredDescription
itemsBreadcrumbItem[]YesArray of { label, to } or { name, item }. Relative URLs resolved to absolute.

XSchemaEvent — Events and conferences

PropTypeRequiredDescription
namestringYesEvent name.
descriptionstringYesEvent description.
startDatestringYesISO 8601 start date/time.
endDatestringYesISO 8601 end date/time.
eventAttendanceModestringNoAttendance mode (default: "OnlineEventAttendanceMode").
locationobjectNoLocation object.
offersOfferNoTicket offer.

XSchemaFAQ — FAQ pages

PropTypeRequiredDescription
itemsFAQ[]YesArray of { question, answer } (also accepts label/content or name/text).
pageTitlestringNoPage title.
datePublishedstringNoPublication date.
authorstring | PersonNoPage author.

XSchemaHowTo — Step-by-step guides

PropTypeRequiredDescription
namestringYesGuide title.
stepsHowToStep[]YesArray of { name, text, image?, url? }.
totalTimestringNoISO 8601 duration (e.g. "PT30M").
supplystring[]NoRequired supplies.
toolstring[]NoRequired tools.

XSchemaLocalBusiness — Business locations

PropTypeRequiredDescription
namestringYesBusiness name.
businessTypestringYesSchema.org type (e.g. "Restaurant", "Store").
urlstringYesBusiness website URL.
addressPostalAddressYesBusiness address.
telephonestringNoPhone number.
openingHoursSpecificationobject[]NoOpening hours.
aggregateRatingAggregateRatingNoRating summary.
priceRangestringNoPrice range (e.g. "$$").

XSchemaOffer — Pricing offers

PropTypeRequiredDescription
namestringYesOffer name.
pricestring | numberYesPrice value.
priceCurrencystringNoISO 4217 currency (default: "USD").
availabilitystringNoAvailability (default: "InStock").
validThroughstringNoOffer expiry date.

XSchemaOrganization — Company information

PropTypeRequiredDescription
namestringYesOrganization name.
urlstringYesWebsite URL.
logostringYesLogo image URL.
sameAsstring[]NoSocial media URLs.
foundingDatestringNoFounding date.
founderstring | PersonNoFounder.

XSchemaPerson — Author/team profiles

PropTypeRequiredDescription
namestringYesPerson name.
jobTitlestringNoJob title.
imagestringNoPhoto URL.
sameAsstring[]NoSocial profiles.
knowsAboutstring[]NoExpertise topics.

XSchemaProduct — Products with offers

PropTypeRequiredDescription
namestringYesProduct name.
descriptionstringYesProduct description.
offersOfferYesPricing offer.
imagestring | string[]NoProduct image(s).
aggregateRatingAggregateRatingNoRating summary.
skustringNoProduct SKU.

XSchemaQAPage — Q&A pages

PropTypeRequiredDescription
itemsQAItem[]YesArray of { question, answer, answerAuthor?, upvoteCount? }.

XSchemaReview — Reviews and ratings

PropTypeRequiredDescription
itemReviewedobjectYesThe item being reviewed (include @type).
reviewRatingRatingYes{ ratingValue, bestRating? }.
authorstring | PersonYesReviewer.
isAggregatebooleanNoRender as AggregateRating instead.

XSchemaService — Service pages

PropTypeRequiredDescription
namestringYesService name.
descriptionstringYesService description.
serviceTypestringYesService type identifier.
areaServedstring | string[]NoGeographic area served.

XSchemaSoftwareApplication — Web/mobile apps

PropTypeRequiredDescription
namestringYesApp name.
descriptionstringYesApp description.
urlstringYesApp URL.
applicationCategorystringYesCategory (e.g. "BusinessApplication").
operatingSystemstring | string[]NoSupported OS(es).

XSchemaVideoObject — Video content

PropTypeRequiredDescription
namestringYesVideo title.
descriptionstringYesVideo description.
thumbnailUrlstring | string[]YesThumbnail URL(s).
uploadDatestringYesISO 8601 upload date.
durationstringNoISO 8601 duration (e.g. "PT10M30S").
contentUrlstringNoDirect video URL.
embedUrlstringNoEmbed URL.

XSchemaWebSite — Site-wide schema

PropTypeRequiredDescription
namestringYesSite name.
urlstringYesSite URL.
enableSearchBoxbooleanNoEnable Sitelinks Search Box.
searchUrlstringNoSearch URL template (required if enableSearchBox).

useSchema() Composable

MethodReturnsDescription
siteUrlComputedRef<string>Configured site URL (no trailing slash).
siteNameComputedRef<string>Configured site name.
resolveUrl(path)string | undefinedConvert relative URL to absolute.
getDefaultOrganization()OrganizationDefault org from app config.
getDefaultPublisher()objectDefault publisher with ImageObject logo.
normalizeAuthor(author)Person | Person[] | undefinedConvert string/array to Person schema.
normalizeImage(image)string[] | undefinedEnsure image is array.
useSchemaHead(fn)voidInject JSON-LD into <head> via useHead.

Environment Variables

None required. All configuration is via app.config.ts.

How It Works

Each XSchema* component calls useSchema().useSchemaHead() which wraps useHead() to inject a <script type="application/ld+json"> tag into the page <head>. Because useHead is SSR-safe, the JSON-LD is rendered server-side and visible to crawlers on first paint. Default values for publisher/organizer come from app.config.ts via useSchema(), so branding is configured once and reused across all components. String values for author, founder, and brand are automatically converted to proper Schema.org typed objects.

Test your output: Google Rich Results Test · Schema.org Validator

Copyright © 2026