{{{
loc = f'{protocol}://{domain}{self._location(item)}' = https://django/test
}}}
and
{{{
alternate = f'{protocol}://{domain}/{self._location(item, lang_code)}' =
https://django/test
}}}
This means that the base url and the internationally pointing url are the
same thing and unless you have automatic language redirection a search
engine will server users in another country the same base page
An adjustment I made which solved this problem for me is this
{{{
alternate = f'{protocol}://{domain}/{lang_code}{self._location(item,
lang_code)}' = https://django/en/test
}}}
That causes all alternate urls to be generated with the required lang
codes included in the urls and allows the sitemap to contain all variants
of the website
meaning the search engine will now server users in the appropriate
location with the right page variant without requiring automatic
redirection
This adjustment is only in line 188 of the sitemap initialization file
the x-default stays the same but options could be added to make it a
certain lang code
--
Ticket URL: <https://code.djangoproject.com/ticket/33418>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "__init__.py" added.
Adjustment made to sitemap initializer
* owner: nobody => ravi kunwar
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/33418#comment:1>
* status: assigned => closed
* cc: Carlton Gibson, Florian Demmer (added)
* component: Internationalization => contrib.sitemaps
* easy: 1 => 0
* has_patch: 1 => 0
* resolution: => invalid
Comment:
As far as I'm aware `alternates` contain language codes, see tests added
in 16218c20606d8cd89c5393970c83da04598a3e04. Maybe you have `i18n`
disabled.
--
Ticket URL: <https://code.djangoproject.com/ticket/33418#comment:2>