nuxt-seomatic-meta icon indicating copy to clipboard operation
nuxt-seomatic-meta copied to clipboard

Multisite not working with language in path

Open maximepalau opened this issue 4 years ago • 3 comments

Hi,

I'm experiencing an issue with the multisite logic.

I’m using nuxt-i18n to manage the languages of my application. For a same page in two different languages, the URLs are like the following:

  • EN: https://www.mysite.com/my-page
  • FR: https://www.mysite.com/fr/ma-page

The issue is that, when I do have a /fr prefix in my route, that prefix is sent to SEOmatic via the uri parameter (see screenshot below), and because of this SEOmatic cannot find the related entry. Craft does not include the language in the URIs of the pages. When I remove this prefix manually, it works.

Screenshot 2020-04-02 at 10 19 17

This is what I did (in a simplified version) to make it work:

let fullPath = route.fullPath;

if (fullPath.startsWith('/fr')) {
     fullPath = route.fullPath.replace('/fr/', '/');
}

return await app.seomaticMeta({ fullPath }, siteId);

I guess we can agree this is not a sustainable solution. Is there a way (with the current methods/configuration elements) to indicate to the plugin the languages to remove from the path for all the pages? Would it be possible to implement that feature otherwise?

maximepalau avatar Apr 02 '20 08:04 maximepalau