Skip to content

Commit 3d1bf94

Browse files
committedFeb 5, 2025
fix(schema-org,vue): support useSchemaOrg options
1 parent 0f14f9f commit 3d1bf94

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed
 

‎packages/schema-org/src/vue/runtime/composables.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ResolvableProperties } from '@unhead/vue'
1+
import type { ResolvableProperties, UseHeadOptions } from '@unhead/vue'
22
import type {
33
AggregateOffer,
44
AggregateRating,
@@ -158,9 +158,9 @@ export function defineBookEdition<T extends Record<string, any>>(input?: Resolva
158158

159159
export type UseSchemaOrgInput = Arrayable<ResolvableProperties<Thing | Record<string, any>>>
160160

161-
export function useSchemaOrg(input: UseSchemaOrgInput) {
161+
export function useSchemaOrg(input: UseSchemaOrgInput, options?: UseHeadOptions) {
162162
// lazy initialise the plugin
163-
const head = injectHead()
163+
const head = options?.head || injectHead()
164164
head.use(UnheadSchemaOrg())
165165
return useHead<{ script: { nodes: UseSchemaOrgInput } }>({
166166
script: [
@@ -170,5 +170,7 @@ export function useSchemaOrg(input: UseSchemaOrgInput) {
170170
nodes: input,
171171
},
172172
],
173+
}, {
174+
head,
173175
})
174176
}

0 commit comments

Comments
 (0)