@24hr/react-structured-data

1.0.2 • Public • Published

@24hr/react-structured-data

This is a simple React component to render a script tag as type application/ld+json. This can be used to create structured data for Google search according to the Schema.org definition.

How to use

  1. Import the module
import StructuredData from '@24hr/react-structured-data';
  1. Use it
<StructuredData type={structureDataType} {...structuredDataObject} />

Props - General

Prop Type Default
context string https://schema.org
type string (required) undefined

You can then pass it whatever structured data compatible objects as you want. These are just passed along.

Props - FAQPage component

Prop Type Default
questions array (required)

A question object should have the structure:

{
    question: String,
    answer: String
}

Example - FAQ Page

Import the built-in FAQPage component

import React from 'react';
import { FAQPage } from '@24hr/react-structured-data';

const App = () => (
    <div>
        {/* Your content */}
        <FAQPage
            questions={[
                {
                    question: 'Test',
                    answer: 'Okey'
                }
            ]}
        />
    </div>
);

Readme

Keywords

none

Package Sidebar

Install

npm i @24hr/react-structured-data

Weekly Downloads

79

Version

1.0.2

License

MIT

Unpacked Size

11 kB

Total Files

8

Last publish

Collaborators

  • inna.aleshina
  • simon.sporrong
  • mikaela.ruden
  • jaarni
  • daniumdev
  • thjo
  • richardsweeney
  • alexander-nilsson
  • camilo.tapia
  • 24hr-machine-user
  • insidenpm
  • bextex
  • victorglimskog
  • resurs-wikskold
  • younous_abdallah
  • resurs_software_solutions_machine_user