X Enterprises
Composables

useXAFStructuredData

Multi-export schema.org JSON-LD composable — VideoObject, HowTo, ItemList, SoftwareApplication, and Recipe rich results.

useXAFStructuredData

Multi-export schema.org JSON-LD composable covering the rich-result types that useSchema doesn't: VideoObject, HowTo, ItemList, SoftwareApplication, and Recipe. Each function builds the schema object, strips empty values via cleanSchema(), and injects a <script type="application/ld+json"> block into the page head.

These five functions are exported from a single multi-export file and are not registered in the layer's imports.presets block, so they are not auto-imported under their own names. Most sites never call them directly — <XAFVideoEmbed>, <XAFHowTo>, and <XAFRecipe> emit their schema internally. Reach for these when you hand-roll a page that needs one of these schema types.

Exports

useXAFVideoSchema(input)

Emit Schema.org VideoObject — drives video rich results in Google SERPs. Call on pages that embed video reviews or tutorials. Returns null when input.name is empty.

FieldTypeDescription
namestringVideo title shown in SERPs. Required.
descriptionstringVideo description.
thumbnailUrlstring | string[]Thumbnail image URL(s).
uploadDatestringISO 8601 upload date (e.g. '2026-01-15').
durationstringISO 8601 duration (e.g. 'PT5M30S').
contentUrl / embedUrlstringDirect video file URL / embed URL (e.g. YouTube iframe src).
author{ name: string, url?: string }Video author.

useXAFHowToSchema(input)

Emit Schema.org HowTo with ordered HowToStep items. Used internally by <XAFHowTo>.

useXAFItemListSchema(input)

Emit Schema.org ItemList — drives carousel/list rich results on listing pages (/reviews, category indexes).

useXAFSoftwareApplicationSchema(input)

Emit Schema.org SoftwareApplication — for app / tool reviews with ratings and offers.

useXAFRecipeSchema(input)

Emit Schema.org Recipe with ingredients, steps, and nutrition. Used internally by <XAFRecipe>.

All five return the emitted schema object (or null when required input is missing) and inject the JSON-LD block via useHead.


AI Context

composable: useXAFStructuredData
package: "@xenterprises/nuxt-x-affiliate"
use-when: >
  Emitting VideoObject / HowTo / ItemList / SoftwareApplication / Recipe
  JSON-LD on hand-rolled pages. Not auto-imported (multi-export file
  outside imports.presets) — XAFVideoEmbed / XAFHowTo / XAFRecipe call
  these internally, so most consumers never import them directly.
Copyright © 2026