New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-plugin-og-images

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-og-images

Generate OG images for your statically generated pages

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21
increased by133.33%
Maintainers
1
Weekly downloads
 
Created
Source

Description

Easly get dynamically generated open graph images for your markdown pages out of a custom template of your own and use the nifty component to pass to your pages SEO ready og images.

How to install

  1. yarn add gatsby-plugin-og-images or npm i gatsby-plugin-og-images
  2. Place your config options in your main gatsby-config.js as mentioned below.

Sample gatsby-config.js configuration:

plugins: [
  {
    resolve: 'gatsby-plugin-og-images',
    options: {
      template: 'og',
      domain: process.env.GATSBY_DOMAIN,
      debug: true
    }
  }
];

Available options

optionvaluedescription
templatestring (required)Provide here the template you want to use as the OG image page (from the /templates folder
domainstring (required, unless hosted on Netlify)Provide here the url of your website, you can obviously store it in a .env variable and ie. process.env.GATSBY_DOMAIN
debugboolean (otional)Log the generated og images

In-built SEO component

In combo with og image generation the plugin provides a component that in combo with react-helmet provides SEO friendly og:images.

To use it:

...
import OgImage from  'gatsby-plugin-og-images'
....

const  Og = ({ data }) => {
	const { id } = data.markdownRemark
	return (
		<div>
			...
			<OgImage id={id}  />
		</div>
	)
}

export const og = graphql`
query og($id: String!) {
	markdownRemark(id: { eq: $id }) {
		id
	}
}`

Keywords

FAQs

Package last updated on 04 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc