Quick Answer: Create custom Schema.org nodes by passing a plain object to useSchemaOrg(). Use @type for the schema type and any valid Schema.org properties.
If you need to add a node that isn't officially implemented, you can provide it yourself. This is useful for:
Custom nodes are plain objects following the Schema.org specification.
import { useSchemaOrg } from '@unhead/schema-org/solid-js'
useSchemaOrg([
{
'@type': 'SingleFamilyResidence',
'numberOfRooms': 3,
'occupancy': 5,
'numberOfBathroomsTotal': 2,
'floorSize': '2000 sqft',
'petsAllowed': true,
}
])
Use schema-dts for full TypeScript support with custom nodes.
import type { DefinedTerm } from 'schema-dts'
import { useSchemaOrg } from '@unhead/schema-org/solid-js'
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',
},
}
])