File tree Expand file tree Collapse file tree 3 files changed +2
-29
lines changed
Expand file tree Collapse file tree 3 files changed +2
-29
lines changed Original file line number Diff line number Diff line change 4141 },
4242 "dependencies" : {
4343 "@nuxt/kit" : " 3.0.0" ,
44- "@unhead/schema-org-vue" : " ^0.1 .2" ,
44+ "@unhead/schema-org-vue" : " ^0.2 .2" ,
4545 "pathe" : " ^1.0.0"
4646 },
4747 "devDependencies" : {
Original file line number Diff line number Diff line change 5454 "vue" : " >=3.2.0"
5555 },
5656 "dependencies" : {
57- "@unhead/schema-org-vue" : " ^0.1 .2"
57+ "@unhead/schema-org-vue" : " ^0.2 .2"
5858 }
5959}
Original file line number Diff line number Diff line change 1- import { useHead } from '@vueuse/head'
2-
31export * from '@unhead/schema-org-vue'
4-
5- let isSPA : null | true = null
6-
7- // we manually define this to use the useHead from @vueuse /head instead of @unhead /vue
8- export function useSchemaOrg ( input ?: any ) : any {
9- // if we're not in development, and we already have a schema org entry, do nothing
10- // Note: usage of this function should be removed by the bundler in production
11- if ( process . env . NODE_ENV !== 'development' && typeof window !== 'undefined' ) {
12- if ( isSPA === null && ! window . document . querySelector ( '#schema-org-graph' ) )
13- isSPA = true
14- if ( ! isSPA )
15- return
16- }
17- return useHead ( {
18- script : [
19- {
20- type : 'application/ld+json' ,
21- key : 'schema-org-graph' ,
22- id : 'schema-org-graph' ,
23- // @ts -expect-error runtime
24- nodes : input ,
25- } ,
26- ] ,
27- } , { mode : isSPA ? 'all' : 'server' } )
28- }
You can’t perform that action at this time.
0 commit comments