File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,18 +11,20 @@ export const JSONLD = props => {
1111 ? Object . assign ( { '@context' : 'http://schema.org/' } , { [ type ] : firstChild } )
1212 : Object . assign ( { '@context' : 'http://schema.org/' } , firstChild )
1313 }
14- return (
15- < script
16- type = "application/ld+json"
17- dangerouslySetInnerHTML = { {
18- __html : JSON . stringify ( json ) ,
19- } }
20- />
14+
15+ return ( props . dangerouslyExposeHtml
16+ ? < script type = "application/ld+json" dangerouslySetInnerHTML = { { __html : JSON . stringify ( json ) } } />
17+ : < script type = "application/ld+json" > { JSON . stringify ( json ) } </ script >
2118 ) ;
2219}
2320
2421JSONLD . propTypes = {
25- additionalType : PropTypes . object
22+ additionalType : PropTypes . object ,
23+ dangerouslyExposeHtml : PropTypes . bool
24+ } ;
25+
26+ JSONLD . defaultProps = {
27+ dangerouslyExposeHtml : false
2628} ;
2729
2830export default JSONLD ;
Original file line number Diff line number Diff line change 88 Review ,
99 Author ,
1010 Location ,
11- Rating
11+ Rating ,
12+ Generic
1213} from 'react-structured-data' ;
1314
1415
You can’t perform that action at this time.
0 commit comments