react-ogp
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

react-ogp

Vulnerabilities Version Last commit Minified size Downloads

The ultimate React OpenGraph component.

Features

  • Automatically sets url / secure_url for images and videos.
  • TypeScript support
  • Forcing to complete all properties for an object not to forget to fill some fields

Install

pnpm i react react-ogp

Usage

Next.js

import React from 'react'
import { OGP } from 'react-ogp'
import Head from 'next/head'

export default function Index() {
  return (
    <>
      <Head>
        <OGP
          url="https://example.com"
          title="My website"
          description="This is my website"
          siteName="example.com"
          image="http://example.com/cover.jpg"
        />
      </Head>
    </>
  )
}

React Helmet

import React from 'react'
import { OGP } from 'react-ogp'
import { Helmet as Head } from 'react-helmet'

export default function Index() {
  return (
    <>
      <Head>
        <OGP
          url="https://example.com"
          title="My website"
          description="This is my website"
          siteName="example.com"
          image="http://example.com/cover.jpg"
        />
      </Head>
    </>
  )
}

Package Sidebar

Install

npm i react-ogp

Weekly Downloads

34

Version

0.0.3

License

MIT

Unpacked Size

15.2 kB

Total Files

6

Last publish

Collaborators

  • dropthebeatbro