- Issue created by @xavier.masson
- Status changed to Needs review
about 1 year ago 9:57am 25 October 2023
When building the Sitemap for my site, the simple_sitemap_hidden_language_remove_language
function enter into the condition :
// Check if the language is hidden.
if (in_array($lang_code, $excluded_languages) || $lang_code == $default_language) {
The first condition : in_array($lang_code, $excluded_languages)
returns FALSE
(i've only excluded English language, the current URL have the French language).
The second condition : $lang_code == $default_language
returns TRUE
because my default language is French and the URL language is French too.
The condition $lang_code == $default_language
is just used to enter in the condition and run the code below, but in my case i've no URL exceptions listed :
// If is hidden language exception and is default lang code return false.
if ($isUrlexception && $lang_code == $default_language) {
$result[$url] = FALSE;
return $result[$url];
}
Finally the code ends and return TRUE (to remove the URL) by the code below :
// If isn't a hidden language exception or is default lang code return true.
$result[$url] = TRUE;
return $result[$url];
It's an regression because it miss to check if the URL langcode is not listed as hidden languages.
After checking if ther are URL exceptions, check if the URL language is configured as excluded languages :
// The URL lang code is not configured as excluded languages, so return
// FALSE.
if (!in_array($lang_code, $excluded_languages)) {
$result[$url] = FALSE;
return $result[$url];
}
otherwise it continue to the existing code :
// If isn't a hidden language exception or is default lang code return true.
$result[$url] = TRUE;
return $result[$url];
Needs review
2.0
Code