Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

gatsby-plugin-dedupe-head

Version on NPM MIT Licensed

A GatsbyJS plugin to omit duplicated elements in the <head>.

This plugin only affects the rendered HTML content, enough for SEO purpose.

List of properties to handle

Which tags will be de-duplicated:

  • title
  • meta[name=description]
  • link[rel=canonical]
  • meta[property=og:type]
  • meta[property=og:url]
  • meta[property=og:title]
  • meta[property=og:description]
  • meta[property=og:determiner]
  • meta[property=og:locale]
  • meta[property=fb:app_id]
  • meta[name=twitter:*]

This list cannot be customized yet. If you need other properties please file an issue.

Usage

{
  plugins: [
    // Place this to last as possible.
    {
      resolve: 'gatsby-plugin-dedupe-head',
      options: {
        strategy: 'pick_last', // default
      },
    },
  ],
}

You can choose the dedupe strategy in pick_first or pick_last.

  • pick_first: Keep the first matched tag. Omit others.
  • pick_last: Keep the last matched tag. Omit others.

LICENSE

MIT

© 2023 Gatsby, Inc.