All Projects β†’ squer-solutions β†’ gatsby-plugin-open-graph-images

squer-solutions / gatsby-plugin-open-graph-images

Licence: other
πŸ–Ό Open-Graph Images derived and generated from React Components

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to gatsby-plugin-open-graph-images

gatsby-theme-jam-example
An example submission for the Gatsby Theme Jam.
Stars: ✭ 89 (+456.25%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-source-moltin
πŸš€ Gatsby source plugin for building Elastic Path Commerce Cloud powered eCommerce websites
Stars: ✭ 21 (+31.25%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-source-firestore
Gatsby source plugin for building websites using the Firestore as a data source.
Stars: ✭ 30 (+87.5%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-plugin-lunr
Gatsby plugin for full text search implementation based on lunr client-side index. Supports multilanguage search.
Stars: ✭ 69 (+331.25%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-plugin-robots-txt
Gatsby plugin that automatically creates robots.txt for your site
Stars: ✭ 105 (+556.25%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-plugin-prettier-build
prettify gatsby build output
Stars: ✭ 30 (+87.5%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-plugin-disqus
πŸ’¬ A plugin for adding Disqus comments to GatsbyJS
Stars: ✭ 40 (+150%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-source-directus7
Source plugin for pulling data into GatsbyJS from Directus CMS (https://directus.io)
Stars: ✭ 17 (+6.25%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-theme-deck-n-blog
Create a deck (with mdx-deck) and a blog post from the same MDX
Stars: ✭ 17 (+6.25%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-plugin-dynamic-routes
Creating dynamic routes based on your environment and/or renaming existing routes
Stars: ✭ 14 (-12.5%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-i18n
Gatsby plugin that provides i18n support
Stars: ✭ 25 (+56.25%)
Mutual labels:  gatsby, gatsby-plugin
chandrikadeb7.github.io
Personal portfolio website hosted using GitHub Pages - Version 2
Stars: ✭ 99 (+518.75%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-source-stripe
Gatsby source plugin for building websites using Stripe as a data source
Stars: ✭ 71 (+343.75%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-plugin-apollo-client
πŸ“‘Inject a Shopify Apollo Client into the browser.
Stars: ✭ 20 (+25%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-attila-theme-ghost
A Gatsby theme plugin for creating blogs from headless Ghost CMS.
Stars: ✭ 16 (+0%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-plugin-optimize-svgs
A Gatsby Plugin to minify SVGs output to the filesystem during the build.
Stars: ✭ 39 (+143.75%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-plugin-tailwindcss
Plug Tailwind CSS to your Gatsby website
Stars: ✭ 46 (+187.5%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-source-behance
Gatsby source plugin for loading information from Behance
Stars: ✭ 17 (+6.25%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-theme-gallery
🏞 A Gatsby Theme for adding a gallery to your site.
Stars: ✭ 40 (+150%)
Mutual labels:  gatsby, gatsby-plugin
gatsby-theme-nehalem
A Gatsby blog theme.
Stars: ✭ 168 (+950%)
Mutual labels:  gatsby, gatsby-plugin

gatsby-plugin-open-graph-images

Gatsby Plugin: Open Graph Images

Publish npm version

A Gatsby plugin to derive and generated Images for the Open Graph Protocol directly from React Components.

How to install

  1. yarn add gatsby-plugin-open-graph-images or npm i gatsby-plugin-open-graph-images
  2. Place the plugin in your main gatsby-config.js:
plugins: [`gatsby-plugin-open-graph-images`];

How to use

The creation of Open Graph images is done by createOpenGraphImage() within your gatsby-node.js file.

exports.createPages = async ({ actions }) => {
  const { createPage } = actions;

  const openGraphImage = createOpenGraphImage(createPage, {
    path: "/og-image/index.png",
    component: path.resolve(`src/templates/index.og-image.js`),
    size: {
      width: 400,
      height: 50,
    },
    waitCondition: "networkidle0",
    context: {
      description: "a image created with gatsby-plugin-open-graph-images",
    },
  });
};

You can than simply include your open-graph image within your page. For example by using react-helmet:

<Helmet>
  <meta property="og:image" content={domain + "/og-image/index.png"} />
  <meta property="og:image:width" content="400" />
  <meta property="og:image:width" content="50" />
</Helmet>

A more advanced usage of createOpenGraphImage() is described in this dev.to article.

Options

option type description
defaultSize optional The default size for the generated image if not explicitly specified.
default: { width: 1200, height: 630}
componentGenerationDir optional The directory where the rendered gatsby components are temporarily stored, to be later saved as images
default: "__generated"

If you use plugins that iterate over your pages, like gatsby-plugin-sitemap, exclude the componentGenerationDir:

{
  resolve: `gatsby-plugin-sitemap`,
  options: {
    exclude: [`/__generated/*`],
  },
},
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].