Core Concepts
Deduping Nodes
On this page
Quick Answer: Schema.org nodes are automatically deduplicated by their @id. Only one node of each type (like WebPage) can exist by default. Later definitions merge with earlier ones unless you specify a custom @id.
How does node deduplication work?
When generating many of the Schema.org nodes a default global @id is used to help with best practices.
For example:
import { defineOrganization, useSchemaOrg } from '@unhead/schema-org/vue'
useSchemaOrg([
defineOrganization() // generates the nodes with an #identity id
])
This allows the node relations to be automatically mapped for best practices.
import { defineWebPage, useSchemaOrg } from '@unhead/schema-org/vue'
useSchemaOrg([
defineWebPage() // knows to link the #identity id
])
How do I add multiple nodes of the same type?
The default @id can prevent having multiple nodes of the same type. Provide your own @id to create separate nodes:
import { defineOrganization, useSchemaOrg } from '@unhead/schema-org/vue'
useSchemaOrg([
defineOrganization({
'@id': '#some-company'
})
])
How do I replace a node instead of merging?
Use tagDuplicateStrategy: 'replace' to fully replace a node instead of merging properties:
import { defineOrganization, useSchemaOrg } from '@unhead/schema-org/vue'
useSchemaOrg([
defineOrganization({
'@id': '#some-company',
'name': 'Bar Company',
'url': 'https://bar.com',
}),
])
useSchemaOrg([
defineOrganization({
'@id': '#some-company',
'name': 'Foo Company',
})
], {
tagDuplicateStrategy: 'replace'
})
// Replaced!
// {
// '@id': '#some-company',
// name: 'Foo Company',
// }
Did this page help you?