-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Sitemap multilanguage problem #3215
Labels
Comments
I just solved the problem with less duplications, but I think it is still not the best solution. All changes I did in
|
Could you provide us a PR ? we will be able to see the changes and try to improve it. |
Sure, will do it today |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are problem with sitemap generation when multiple locales are enabled.
The problem is in two places:
1.
https://github.com/refinery/refinerycms/blob/master/core/app/views/refinery/sitemap/index.xml.builder#L11
When this
page_url
(prepared as Hash) goes torefinery.url_for(page_url)
, it haslocale
key with locale, set in my browser (which is always will be:ru
), and when theRouteFilter
tries to generate url for current ::I18n.locale, it uses exactly params[:locale](look here https://github.com/refinery/refinerycms-i18n/blob/master/lib/refinery/i18n-filter.rb#L23). Probably, when sitemap.xml is called by search bots, there will be no :locale key in params, but I am not sure. The possible solution can be using modified line:This way, url_for will get modified params[:locale], as it is currently set buy
@locales.each do |locale|
loop. And the line::I18n.locale = locale
can be removed.2.
More serious problem takes place when the url_for gets String as
page_url
, which happens when the page with redirection is precessing (or even root page of site). In this case, the moduleRoutingFilter::RefineryLocales
is not fired at all, so for all the locales in @locales array there will be absolutely identical urls. I don`t know how to solve this problem best, but there is at least stupid way to duplicate some code from here https://github.com/refinery/refinerycms-i18n/blob/master/lib/refinery/i18n-filter.rb#L30 to here https://github.com/refinery/refinerycms/blob/master/core/app/views/refinery/sitemap/index.xml.builder#L14, and this is obviously ugly solution. Any suggestions?The text was updated successfully, but these errors were encountered: