nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.75k stars 483 forks source link

Canonical and Hreflang Links output encoded #2764

Closed readio closed 1 month ago

readio commented 9 months ago

Environment


Reproduction

Version: "@nuxtjs/i18n": "^7.3.1"

Describe the bug

Canonical and Hreflang Links output encoded in the head.

Example: <link data-n-head="ssr" data-hid="i18n-can" rel="canonical" href="/en/pages%2Ffaq">

According to our SEO team:

This issue affects the proper indexing of the pages, leading to SEO indexing problems and content duplication concerns.

The canonical link still serves the same content. The issue is that it's telling search engines to ignore the live link and focus on indexing the incorrect coded link that is orphaned.

I've a had look in node_modules/@nuxtjs/i18n/src/templates/head-meta.js.

Below is the output of `this.$route':

fullPath: "/en/pages/faq"
path: "/en/pages/faq"
...

However, the links are generated with currentRoute which outputs below:

fullPath: "/en/pages%2Ffaq"
path: "/en/pages%2Ffaq"
...

Is there a reason that '/' characters are encoded, and is there a way it can be changed?

Additional context

No response

Logs

No response

BobbieGoede commented 1 month ago

Closing this as v7 is not being actively worked on (critical hotfixes only), if this still applies to v8 and later please open a new issue!