Skip to content

initialCanonicalUrl in scripts confuse search crawlers #53274

@frontimin

Description

@frontimin

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: x64
      Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:53:44 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T8103
    Binaries:
      Node: 18.13.0
      npm: 9.8.1
      Yarn: 1.22.10
      pnpm: N/A
    Relevant packages:
      next: 13.4.7
      eslint-config-next: 13.4.1
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.0.4

Which area(s) of Next.js are affected? (leave empty if unsure)

Metadata (metadata, generateMetadata, next/head)

To Reproduce

Open Vercel website on /about page, open devtools 'Elements' tab, open search input with cmd + F and type initialCanonicalUrl, you will see this in one of the <script> tags:
... \"initialCanonicalUrl\":\"/app-future/en/about\", ...

Open /app-future/en/about and see that you get the same page!

Describe the Bug

Actual page path and initialCanonicalUrl are different.
Our SEO department reported this problem to us, as they said it confuses the search engine robots (don't ask me why) and reduce SEO optimization points.
For our case it looks like:
/blog/example-article – actual page path at English locale
/en/blog/example-article – initialCanonicalUrl from <script>

Expected Behavior

/blog/example-article – actual page path at English locale
/blog/example-article – initialCanonicalUrl from <script>

Which browser are you using? (if relevant)

Google Chrome

How are you deploying your application? (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.locked

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions