Skip to content

Instantly share code, notes, and snippets.

@laradevitt
Created August 20, 2019 19:17
Show Gist options
  • Save laradevitt/54e9125a086c80d8178bc5cdcc77c25c to your computer and use it in GitHub Desktop.
Save laradevitt/54e9125a086c80d8178bc5cdcc77c25c to your computer and use it in GitHub Desktop.
react-structured-data example - Google Structured Data 'Event'

Example generic type when using React Structured Data

<JSONLD dangerouslyExposeHtml={true}>
  <Generic
    type="Event"
    jsonldtype="Event"
    schema={{
      name: `Somebody at ${content.venue}`,
      startDate: content.date,
      endDate: content.date,
      description: content.description.text,
      image: [config.siteImage],
    }}
  >
    <Generic
      type="location"
      jsonldtype="Place"
      schema={{
        name: content.venue,
      }}
    >
      <Generic
        type="address"
        jsonldtype="PostalAddress"
        schema={{
          addressLocality: content.city,
          addressRegion: content.state,
          addressCountry: content.country,
        }}
      />
    </Generic>
    <Generic
      type="offers"
      jsonldtype="Offer"
      schema={{
        url: content.tickets ? content.tickets.url : null,
      }}
    />
    <Generic
      type="performer"
      jsonldtype="Person"
      schema={{
        name: 'Somebody',
      }}
    />
  </Generic>
</JSONLD>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment