Skip to content
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

Both original and translated routes exist: Duplicate Content #26

Open
jensb opened this issue Oct 9, 2011 · 5 comments
Open

Both original and translated routes exist: Duplicate Content #26

jensb opened this issue Oct 9, 2011 · 5 comments

Comments

@jensb
Copy link

jensb commented Oct 9, 2011

Hello,

when I use your plugin, both the original and the translated routes exist. This is a problem because it creates duplicate content, which is bad for SEO.

Is it possible to have only the translated routes, and remove the original routes, when the locale is set to a language other than the default?

Thanks!

@juhat
Copy link

juhat commented Nov 7, 2011

I had the same problem - but it can be solved easily with a redirect call. Redirect all stuff to the new place. You can use parameters in rails redirects, so you can redirect all contents easily.

@jensb
Copy link
Author

jensb commented Nov 7, 2011

The issue is not really solved with a redirect. It works for users, but when pages are indexed by search engines, this can destroy your ranking (think "duplicate content"). Pages which don't exist or contain duplicate content should return 404.

How did you solve this?

@juhat
Copy link

juhat commented Nov 8, 2011

I see your point. What is the perfect solution to this?

@jensb
Copy link
Author

jensb commented Nov 13, 2011

This is simple: When adding translated routes, remove the original routes from the routing table.

However, I do not know how to do this in i18n-routing ... :)

@rogercampos
Copy link

I also had this problem, the solution I found is to simply add a constraint that checks the locale of the request vs the current locale at the time the definition is executed:

localized([:es, :ca, :en]) do
  scope "/:i18n_locale", :constraints => {:i18n_locale => I18n.locale} do
  end
end

Then make sure you set the locale looking first for the i18n_locale attribute. This is what I have:

def set_locale
  I18n.locale = params[:i18n_locale] || params[:locale]
end

Because I only have a subset of all my routes translated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants