Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-plugin-canonical-urls

Package Overview
Dependencies
Maintainers
0
Versions
347
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-canonical-urls

Add canonical links to HTML pages Gatsby generates.

  • 5.14.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26K
decreased by-1.66%
Maintainers
0
Weekly downloads
 
Created
Source

gatsby-plugin-canonical-urls

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.

Install

npm install gatsby-plugin-canonical-urls

How to use

// In your gatsby-config.js
plugins: [
  {
    resolve: `gatsby-plugin-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/" />

Excluding search parameters

URL search parameters are included in the canonical URL by default. If you worry about duplicate content because for example /blog and /blog?tag=foobar will be indexed separately, you should set the option stripQueryString to true. The latter will then be changed to /blog.

module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-canonical-urls`,
      options: {
        siteUrl: `https://www.example.com`,
        stripQueryString: true,
      },
    },
  ],
}

Keywords

FAQs

Package last updated on 06 Nov 2024

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