Core Concepts
Schema.org Params
Schema.org params provide shared metadata such as host, path, currency, and inLanguage. Each node resolver inherits only the fields it supports.
Schema.org params
Params let you configure metadata used by multiple Schema.org nodes. Set them with the schemaOrg property in templateParams.
import { useHead } from 'unhead'
useHead(unheadInstance, {
templateParams: {
schemaOrg: {
host: 'https://example.com',
path: '/blog'
}
}
})
Available params
host
- type:
string
The origin of your production site, including the protocol, such ashttps://example.com. It is used to generate absolute IDs and URLs.
path
- type:
string - default:
/
The path of the current page. Set it on each page when you are not deriving it in a framework integration.
inLanguage
- type:
string - default:
undefined
SetsinLanguagefor resolvers that inherit it. Use a valid language tag, such asen-AU.
trailingSlash
- type:
boolean - default:
false
Whether to retain a trailing slash on generated page URLs. The root path remains/in either mode.
currency
- type:
string - default:
undefined
Default currency for Offer and other commerce-related nodes that inherit it. Use an ISO 4217 code, such asUSD,EUR, orGBP.
Page metadata
The following optional string params are inherited by resolvers that declare support for them:
titledescriptionimagedatePublisheddateModified
Script Position
tagPosition is an entry option, not a shared Schema.org param. Pass it as the second argument to useSchemaOrg():
useSchemaOrg(unheadInstance, nodes, {
tagPosition: 'head', // or 'bodyOpen' / 'bodyClose'
})
The default is bodyClose.
Param inheritance
Each resolver declares the metadata it inherits. For example, Article inherits inLanguage, while Product uses currency through its nested Offer resolver.
useHead(unheadInstance, {
templateParams: {
schemaOrg: {
host: 'https://example.com',
inLanguage: 'en-AU',
currency: 'AUD'
}
}
})
// Each helper uses the params supported by its resolver
useSchemaOrg(unheadInstance, [
defineWebPage(), // uses host and path for its URL and ID
defineArticle(), // inherits inLanguage
defineProduct({ name: 'Widget', offers: { price: 99 } }) // the Offer inherits currency
])
Did this page help you?