Skip to content

Commit

Permalink
[gatsby-plugins-canonical-urls] Add default pathname (#2363)
Browse files Browse the repository at this point in the history
Fixes #2362 by preventing generated canonial urls from appending
`undefined` in development mode
  • Loading branch information
dlindahl authored and KyleAMathews committed Oct 8, 2017
1 parent 6681a96 commit ce10ef9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-canonical-urls/src/gatsby-ssr.js
@@ -1,6 +1,6 @@
import React from "react"

exports.onRenderBody = ({ setHeadComponents, pathname }, pluginOptions) => {
exports.onRenderBody = ({ setHeadComponents, pathname = `/` }, pluginOptions) => {
const url = `${pluginOptions.siteUrl}${pathname}`
setHeadComponents([<link rel="canonical" key={url} href={url} />])
}

0 comments on commit ce10ef9

Please sign in to comment.