useXAFStructuredData
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.
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.
| Field | Type | Description |
|---|---|---|
name | string | Video title shown in SERPs. Required. |
description | string | Video description. |
thumbnailUrl | string | string[] | Thumbnail image URL(s). |
uploadDate | string | ISO 8601 upload date (e.g. '2026-01-15'). |
duration | string | ISO 8601 duration (e.g. 'PT5M30S'). |
contentUrl / embedUrl | string | Direct 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.
useXafRssFeed
RSS 2.0 feed generation composable — builds channel metadata from xAffiliate.brand defaults and generates feed XML for server routes.
useReferralTracking
Detects referral codes from URL query parameters, persists them to a cookie, and exposes helpers to read, check, and clear the tracked referral.
