Recipes
Custom Nodes
On this page
If you need to add a node that isn't officially implemented, then you can provide it yourself.
Custom nodes are just plain objects that follow the Schema.org specification.
import { useSchemaOrg } from '@unhead/schema-org/typescript'
useSchemaOrg([
{
'@type': 'SingleFamilyResidence',
'numberOfRooms': 3,
'occupancy': 5,
'numberOfBathroomsTotal': 2,
'floorSize': '2000 sqft',
'petsAllowed': true,
}
])
Using Schema-dts
If you'd like to add full TypeScript support, you can use schema-dts.
import type { DefinedTerm } from 'schema-dts'
import { useSchemaOrg } from '@unhead/schema-org/typescript'
useSchemaOrg([
<DefinedTerm> {
'@type': 'DefinedTerm',
'name': 'Unhead Schema.org',
'description': 'Unhead Schema.org is a library for adding Schema.org to your application.',
'inDefinedTermSet': {
'@type': 'DefinedTermSet',
'name': 'Schema.org Libraries',
},
}
])
Did this page help you?