﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33418	Alternates does not use langcodes in alternate urls	U-Eike	ravi kunwar	"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
"	Uncategorized	closed	contrib.sitemaps	4.0	Normal	invalid		Carlton Gibson Florian Demmer	Unreviewed	0	0	0	0	0	0
