Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub


Add canonical links to HTML pages Gatsby generates.

This implementation is primarily helpful for distinguishing between https/http, www/no-www but could possibly be extended to help with when sites add multiple paths to the same page.


npm install --save gatsby-plugin-clean-canonical-urls

How to use

// In your gatsby-config.js
plugins: [
    resolve: `gatsby-plugin-clean-canonical-urls`,
    options: {
      siteUrl: `https://www.example.com`,

With the above configuration, the plugin will add to the head of every HTML page a rel=canonical e.g.

<link rel="canonical" href="https://www.example.com/about-us/" />
© 2023 Gatsby, Inc.