#33418: Alternates does not use langcodes in alternate urls
------------------------------------------------+------------------------
Reporter: U-Eike | Owner: nobody
Type: Uncategorized | Status: new
Component: Internationalization | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
------------------------------------------------+------------------------
As said in the title when using the sitemap creator and alternates all
alternate urls are identical to the location url
Example
{{{
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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.2f1a038d85fd77153968a5f7e332c450%40djangoproject.com.