Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert pathname #487

Closed
MathiasSvDK opened this issue Aug 29, 2023 · 8 comments
Closed

Convert pathname #487

MathiasSvDK opened this issue Aug 29, 2023 · 8 comments
Labels
enhancement New feature or request unconfirmed Needs triage.

Comments

@MathiasSvDK
Copy link

Is your feature request related to a problem? Please describe.

Not really a problem

Describe the solution you'd like

It would be great for SEO to be able to convert the current path from the default langauge to xx langauge the user has.
It would be very much needed for <link rel="canonical"

Describe alternatives you've considered

None

@MathiasSvDK MathiasSvDK added enhancement New feature or request unconfirmed Needs triage. labels Aug 29, 2023
@MathiasSvDK
Copy link
Author

What i request is like in localized pathname:
https://next-intl-docs.vercel.app/docs/routing/navigation
Be able to retrieve the current localized path from the URL into the html to be able to create the <link rel="canonical"

@amannn
Copy link
Owner

amannn commented Aug 30, 2023

Can you elaborate on what kind of canonical link you have to render on your page and why it is necessary?

Note that the next-intl middleware sets the link header for you that provides hints to search engines about different language versions of your page.

@MathiasSvDK
Copy link
Author

We have an issue with google thinking that our .com domain is a copy of .dk (That they don't "work" together).
The pages are identical but translated and we need to let google know that they are the same.

Maybe i am doing it wrong? Do you have any knowledge about this?

@amannn
Copy link
Owner

amannn commented Aug 30, 2023

Do you have alternateLinks enabled in the next-intl middleware?

Please refer to the docs, there's also a link to Google documentation that explains how the link header works.

@MathiasSvDK
Copy link
Author

I don't have it disabled.
I found in the docs, as you linked that it says "Defaults to true" - so i assume it's enabled by default?

@amannn
Copy link
Owner

amannn commented Aug 30, 2023

Yes.

@MathiasSvDK
Copy link
Author

Any suggestion to how i then can fix this issue?

@amannn
Copy link
Owner

amannn commented Aug 31, 2023

Sorry, I'm not sure what the issue is. As mentioned, the middleware returns alternate links, therefore there's no need for canonical links (which shouldn't be used for language versions anyway).

I'll convert this to a discussion since it's a usage question, I hope you understand.

Repository owner locked and limited conversation to collaborators Aug 31, 2023
@amannn amannn converted this issue into discussion #491 Aug 31, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

2 participants