Skip to content
This repository was archived by the owner on Dec 5, 2021. It is now read-only.
This repository was archived by the owner on Dec 5, 2021. It is now read-only.

Duplicated canonical URL tags are produced #87

Description

@ceilfors

Describe the bug

Two canonical tags are produced

To Reproduce

  1. Setup Nuxt and Nuxt page. Our guess is this is related to Nuxt full static mode

nuxt.config.js

export default {
  mode: "universal",
  target: "static"

pages/foo.vue

export default {
  head() {
    return this.$seo({
      title: "London",
    });
  }
}
  1. Go to foo page

Expected behavior
No duplicated canonical URL tag should be produced in the DOM.

<html>
  <head>
    <link data-n-head="ssr" rel="canonical" href="https://upmo.com/foo">
...

Actual behavior
Duplicated canonical URL tags are produced in the DOM.

<html>
  <head>
    <link data-n-head="ssr" rel="canonical" href="https://upmo.com/">
    <link data-n-head="ssr" rel="canonical" href="https://upmo.com/foo">
...

Additional context

When we change the following code inside module.js

this.options.head.link = createCanonical(options, '/').concat(this.options.head.link || [])

To become:

this.options.head.link = this.options.head.link || []

It seems to have fixed the issue, but we're not sure what implication it will make.

P.S. Paired with @hsks

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions