-
-
Notifications
You must be signed in to change notification settings - Fork 483
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
SEO / GoogleBot - Language Redirect's issue #761
Comments
I suppose that the only possible solution for this is detecting crawlers and not redirecting then... |
Yes that would be nice as well. Perhaps some default popular User-Agents to block by default, and then allow the user to define custom agents. Here is a list of popular agents: https://perishablepress.com/list-all-user-agents-top-search-engines/ However, I've heard from a SEO guy that Google also crawls websites using other User-Agents to check if website is "cheating", e.g. only showing some content to crawlers -- I'm not sure a redirect would matter in this case, but I can't say for sure. Either way, it would also be useful to only allow the language redirect on the frontpage (e.g. when user types www.domain.com -- and not when clicking a sent link). |
I'm also having trouble with this, in PWA mode for my case. I was thinking about at least pre-rendering some pages to see if that's solve the problem, but it actually seems to really be the auto redirect which is causing issues. Here is my nuxt-i18n config:
SEO mode is set to false, but I override the head:
This is quite critical because my main user base is supposed to be french, but Google only sees the english version of the app though my default language is set to french everywhere, even in the sitemap. |
Same issue here. In the Goolge Search Console I can see that many of my pages have been excluded as duplicates I don't know if that is a result of the way redirect works right now or if some some configuration mistake was made. If its a bug, I wonder what the best solution would be to fix this, since displaying the correct locale/version of the page to the Google Bot should also work for websites that use static pre-rendered pages, so detection would have to be done in JavaScript.
That would be good option to have, but I think that would only work with the |
Well, googlebot has When testing locally you have to make sure to delete the "i18n" cookie first to trigger the redirect (but then again, it depends on your exact settings. |
I think this article might be very helpful to solve some of the SEO problems:
Actually, according to this article above, the crawler sends HTTP requests without setting Accept-Language in the request header. So the language is probably set via JavaScript's
I'm not sure, that would be the best way to go. Taken from another article about (mobile version) redirection, Google says:
and there was another suggestion:
So I guess the bottom line is, for SEO don't use automatic language redirect (?) Or at least not on ALL pages... My two solutions would be to do either of the two solutions: Solution 1 As suggested above, use the So let's say you have: If you visit the URLs above, you would get served either the EN or DE version of the page, regardless of your browsers language settings. Only if you navigate to I guess this solution could also work with Solution 2 I am however not sure if that would be a good solution as you would end up with the prompt showing up on thumbnail previews of your website. |
That seems promising then because it means we might be able to handle that case in a special way. |
So after some more research it seems that what I suggested as Method 1 above, would probably be the best and also easiest way to go from a SEO standpoint. According to https://support.google.com/webmasters/answer/189077?hl=en you should:
So that means, for ideal SEO you should use the https://some.url/en/hello -> no browser language detection / no redirect That way you don't need to detect whether the user is a bot or not, you would still automatically redirect users who visit a non-locale specific URL and everything would get indexed in Google correctly. The only thing that needs to be done would be to add an option like There was also recently some SEO/localization related sitemap update, which works well with the |
@ems1985 great progress. I like option 1 except I don't like to prefix all pages. Could we still enable the base path redirect on front-page, and not on other pages? |
I guess it would be possible as long as the default (non-prefixed) language is English. But I think its not quite how Google would recommend it, since you tell Google your non-prefixed base URL is a certain Language/Locale (in the sitemap.xml and/or via meta tags), when in reality it could redirect and display a different one. But like I said, if you really want to avoid prefix for default language, it should be possible that way too... (as long as the default language is English) I will try to come up with a quick fix/work-around tomorrow and then maybe someone could help coming up with a permanent solution for this ( I'm not very familiar with the nuxt code yet) But this affects a lot of projects, so I'm sure there is quite some interest to get this done. |
Sounds great @ems1985 ill be happy to test it out |
I referenced my very simple solution above. It basically adds a If you set
the redirection will only be done when you are in the root of your domain. I am using it with the I didn't write any tests or do extensive testing. I think someone more familiar with nuxt-i18n should make those changes, since I very likely didn't think of (or even know) all possible configurations. I also think that this should probably not be treated as a bug but rather as a new feature. |
There is a relevant discussion in #603 |
@rchl true, seems pretty related |
I also encountered this problem, do you plan to fix it? |
Work in progress in #799 |
I wanted to address both this and #455 with the same fix (work in progress at #799) but now I'm having seconds thoughts about it and I think that the current solution (where I'm only redirecting from the root path) wouldn't be right. It wouldn't be ideal for this issue as we would still redirect on the root path so crawlers wouldn't be able to access that one if default locale is other than English (I'm assuming crawlers report English, if anything). And it wouldn't be ideal for #455 as we should redirect from any path as long as it matches the default locale. So I'm thinking that those two issues should be handled separately. For this one, maybe the solution is to not redirect if the user agent doesn't provide Accept-Language information. I just need to be sure what headers are crawlers actually sending. There are some conflicting information about that on the Internet. |
@rchl let me try to clarify a little bit.
Search engine bots fetches robots.txt, after that it takes in account if web-site is allowed to be indexed/parsed. Robots.txt at the same time allows (and all SE suggests) defining sitemap.xml where web-site owners should list all urls that web-site has or should be parsed. Nuxt has a great sitemap module with i18n support where it lists all urls with correct canonical urls (so none of urls wouldn't be marked as duplicates as well as indexed!) See nuxt-community/sitemap-module#91 Robots.txt -> Sitemap.xml -> List of urls.
That's a correct solution for prefixed strategies - redirecting only from the root path.
You shouldn't care about crawlers at all as they're might behave differently and just might be testing different scenarios. -- That's it. -- Thank you for PR! I'm ready to test it, any ETA for alpha/beta release? Thanks! |
I think the part about robots.txt and sitemaps is not relevant to the issue I'm thinking about.
Also for this case?
{ name: 'index___es', url: '/' },
{ name: 'index___en', url: '/en/' },
{ name: 'index___fr', url: '/fr/' } In this case, if the crawler would report |
You've asked how crawlers could detect other links and I've simply tried to answer it. If you still think that isn't related then sorry and accept my apologies.
This issue started as SEO improvement which everyone needs and the main problem was when visiting However, you're asking what to do with the root page? On prefix_except_default root path user (or crawler*) asking for default locale and page shouldn't do redirection. My suggestion would just add another option or just disable redirection on root path for that strategy. There is no possible way to solve this on prefix_except_default root path only, similar to what you were asking about no prefixes strategy. * Every search engine always say that crawlers should be treated as normal users, doing something different based on user-agents or accepted locale wouldn't make it better. |
I've just said that, in that particular case, if I'm gonna redirect from the root path, the crawler will not be able to crawl that one particular page as it will be redirected to
I'll have to think about that... And you know what opinion I have about adding more options...
I don't want to do that. I'm investigating a behavior change that would apply to both crawlers and users but might fix crawlers. Namely, if there is no Accept-Language header provided then don't redirect to the default locale like happens now. Instead, just load the requested locale. Normal users are not likely to have Accept-Language header missing and crawlers potentially don't send it so it could work. |
@rchl well, from what I can see there is already a breaking change with module renaming #800
If adding options isn't the way, then this should be included by default in my opinion (let me clarify this is should be default behavior at first). i18n module is cool, however it's basically great only for user who will change language by clicking somewhere and not locale that could be changed by only visiting any other urls. If it will be enabled by default it will speedup and boost localized sites and ranked in search engines by their locale (this is what I'm trying to achieve with nuxt and any other framework/libraries does this). Forgot to add, under features this module has "Search Engine Optimization" so it wouldn't break up anything with new module renaming at least 😉
This is a bit risky, they do send sometimes and there is no guarantees for them to change in any time. Thanks! |
I don't see how it would be risky though. It would be a consistent behavior (for both normal users and crawlers) when Accept-Language is not provided. |
Hi guys, i finally found this thread that could help with this problem: with nuxt-i18n I set two languages, Italian (default) and English. In fact, as stated before, testing the pages with Search Console it gets redirected to the EN version by default |
|
…ocale Don't attempt to detect browser's language when user (or crawler) goes directly to a page with a locale prefix if that locale is not the default one. This is to avoid redirecting user that potentially wanted to load that specific page rather than the one matching browser's language. Resolves #455 Resolves #761
…ocale Don't attempt to detect browser's language when user (or crawler) goes directly to a page with a locale prefix if that locale is not the default one. This is to avoid redirecting user that potentially wanted to load that specific page rather than the one matching browser's language. Resolves #455 Resolves #761
Don't attempt to detect browser's language when user (or crawler) goes directly to a page with a locale prefix if that locale is not the default one. This is to avoid redirecting user that potentially wanted to load that specific page rather than the one matching browser's language. Resolves #455 Resolves #761
Fix released in v6.15.0 |
My nuxt page head:
My nuxt.config.js
|
Version
nuxt-i18n: 6.13.0-beta.0
nuxt: 2.12.2
Nuxt configuration
mode:
Steps to reproduce
What is Expected?
Should not redirect when a google bot is visiting, OR perhaps a user configurable setting that would allow the browser language redirect to only happen on the frontpage.
What is actually happening?
Google Bot is being redirected to the english translation of a page, when visitng e.g. Danish translation.
The text was updated successfully, but these errors were encountered: