Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/core/schemas/Organization.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import JSONLDAbstractNode from '../JSONLDAbstractNode';

class Organization extends JSONLDAbstractNode {
getJSON(isFirstChildNode = false, schema) {
const parseChildren = super.parseChildren();
const details = {
'@type': 'Organization',
...schema
}
return isFirstChildNode ?
Object.assign(details, ...parseChildren) :
Object.assign({
brand: details
}, ...parseChildren);
}
}

export default Organization;
18 changes: 18 additions & 0 deletions src/core/schemas/PostalAddress.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import JSONLDAbstractNode from '../JSONLDAbstractNode';

class PostalAddress extends JSONLDAbstractNode {
getJSON(isFirstChildNode = false, schema) {
const parseChildren = super.parseChildren();
const details = {
'@type': 'PostalAddress',
...schema
}
return isFirstChildNode ?
Object.assign(details, ...parseChildren) :
Object.assign({
address: details
}, ...parseChildren);
}
}

export default PostalAddress;
4 changes: 4 additions & 0 deletions src/core/schemas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ export { default as Location } from './Location';
export { default as Product } from './Product';
export { default as Rating } from './Rating';
export { default as Review } from './Review';
export { default as PostalAddress } from './PostalAddress';
export { default as Organization } from './Organization';
export { default as Reviews } from './Reviews';
export { default as ItemReviewed } from './ItemReviewed';
export { default as Question } from './Question';
export { default as Answer } from './Answer';
export { default as Graph } from './Graph';


18 changes: 16 additions & 2 deletions src/example/containers/Example.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ import React, { PureComponent } from 'react';
import styles from './Example.scss';
import {
JSONLD,
AggregateRating,
Graph,
Product,
ItemReviewed,
GenericCollection,
Review,
Author,
Location,
Rating,
Generic
Generic,
Organization,
PostalAddress
} from 'react-structured-data';


class Example extends PureComponent {
render() {
return (
Expand Down Expand Up @@ -64,6 +67,17 @@ class Example extends PureComponent {
<Generic type="locationCreated" jsonldtype="AdministrativeArea" schema={{name: "Chicago, IL"}}/>
</Generic>
</JSONLD>
<JSONLD>
<Organization name="John Doe Company"
url="https://www.johnDoeCompany.com"
logo="https://www.johnDoeCompany.tv/wp-content/uploads/2017/08/logo.png">
<PostalAddress addressCountry="HU"
addressLocality="Budapest"
addressRegion="Pest"
postalCode="1063"
streetAddress="Bajnok utca 13" />
</Organization>
</JSONLD>
</section>
</section>
);
Expand Down