@@ -27,23 +27,26 @@ npm install react-schemaorg
2727
2828To insert a simple JSON-LD snippet:
2929
30- ``` ts
30+ ``` tsx
3131import { Person } from " schema-dts" ;
3232import { JsonLd } from " react-schemaorg" ;
3333
3434export function GraceHopper() {
35- return <JsonLd <Person >
36- item ={{
37- " @context" : " https://schema.org" ,
38- " @type" : " Person" ,
39- name: " Grace Hopper" ,
40- alternateName: " Grace Brewster Murray Hopper" ,
41- alumniOf: {
42- " @type" : " CollegeOrUniversity" ,
43- name: [" Yale University" , " Vassar College" ]
44- },
45- knowsAbout: [" Compilers" , " Computer Science" ]
46- }}/>;
35+ return (
36+ <JsonLd <Person >
37+ item = { {
38+ " @context" : " https://schema.org" ,
39+ " @type" : " Person" ,
40+ name: " Grace Hopper" ,
41+ alternateName: " Grace Brewster Murray Hopper" ,
42+ alumniOf: {
43+ " @type" : " CollegeOrUniversity" ,
44+ name: [" Yale University" , " Vassar College" ],
45+ },
46+ knowsAbout: [" Compilers" , " Computer Science" ],
47+ }}
48+ />
49+ );
4750}
4851```
4952
@@ -52,25 +55,27 @@ export function GraceHopper() {
5255To set JSON-LD in React Helmet, you need to pass it to the ` script={[...]} ` prop
5356array in the ` Helmet ` component:
5457
55- ``` tsx
58+ ``` tsx
5659import { Person } from " schema-dts" ;
5760import { helmetJsonLdProp } from " react-schemaorg" ;
5861import { Helmet } from " react-helmet" ;
5962
60- <Helmet script = { [
61- helmetJsonLdProp <Person >({
62- " @context" : " https://schema.org" ,
63- " @type" : " Person" ,
64- name: " Grace Hopper" ,
65- alternateName: " Grace Brewster Murray Hopper" ,
66- alumniOf: {
67- " @type" : " CollegeOrUniversity" ,
68- name: [" Yale University" , " Vassar College" ]
69- },
70- knowsAbout: [" Compilers" , " Computer Science" ]
71- }),
72- ]} />
73- ```
63+ <Helmet
64+ script = { [
65+ helmetJsonLdProp <Person >({
66+ " @context" : " https://schema.org" ,
67+ " @type" : " Person" ,
68+ name: " Grace Hopper" ,
69+ alternateName: " Grace Brewster Murray Hopper" ,
70+ alumniOf: {
71+ " @type" : " CollegeOrUniversity" ,
72+ name: [" Yale University" , " Vassar College" ],
73+ },
74+ knowsAbout: [" Compilers" , " Computer Science" ],
75+ }),
76+ ]}
77+ />;
78+ ```
7479
7580## Developers
7681
0 commit comments