Fix sitemaps
This commit is contained in:
parent
3502c4c269
commit
54c90059ff
@ -2337,17 +2337,18 @@ if ($action == 'generatesitemaps' && $usercanedit) {
|
|||||||
$xhtmllink->setAttribute("rel", "alternante");
|
$xhtmllink->setAttribute("rel", "alternante");
|
||||||
$xhtmllink->setAttribute("hreflang", "'.$tmpshortlangcode.'");
|
$xhtmllink->setAttribute("hreflang", "'.$tmpshortlangcode.'");
|
||||||
$xhtmllink->setAttribute("href", "'.$pageurl.'");
|
$xhtmllink->setAttribute("href", "'.$pageurl.'");
|
||||||
|
$url->appendChild($xhtmllink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add "has translation pages"
|
// Add "has translation pages"
|
||||||
$sql = 'SELECT rowid as id, lang, pageurl from '.MAIN_DB_PREFIX.'website_page where fk_page IN ('.$db->sanitize($objp->rowid.($translationof ? ', '.$translationof : '')).")";
|
$sql = 'SELECT rowid as id, lang, pageurl from '.MAIN_DB_PREFIX.'website_page where fk_page IN ('.$db->sanitize($objp->rowid.($translationof ? ', '.$translationof : '')).")";
|
||||||
$resql = $db->query($sql);
|
$resqlhastrans = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resqlhastrans) {
|
||||||
$num_rows = $db->num_rows($resql);
|
$num_rows_hastrans = $db->num_rows($resqlhastrans);
|
||||||
if ($num_rows > 0) {
|
if ($num_rows_hastrans > 0) {
|
||||||
while ($objhastrans = $db->fetch_object($resql)) {
|
while ($objhastrans = $db->fetch_object($resqlhastrans)) {
|
||||||
$tmpshortlangcode = '';
|
$tmpshortlangcode = '';
|
||||||
if ($objhastrans->lang) {
|
if ($objhastrans->lang) {
|
||||||
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $objhastrans->lang); // en_US or en-US -> en
|
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $objhastrans->lang); // en_US or en-US -> en
|
||||||
@ -2357,6 +2358,7 @@ if ($action == 'generatesitemaps' && $usercanedit) {
|
|||||||
$xhtmllink->setAttribute("rel", "alternante");
|
$xhtmllink->setAttribute("rel", "alternante");
|
||||||
$xhtmllink->setAttribute("hreflang", "'.$tmpshortlangcode.'");
|
$xhtmllink->setAttribute("hreflang", "'.$tmpshortlangcode.'");
|
||||||
$xhtmllink->setAttribute("href", "'.$pageurl.'");
|
$xhtmllink->setAttribute("href", "'.$pageurl.'");
|
||||||
|
$url->appendChild($xhtmllink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2369,6 +2371,7 @@ if ($action == 'generatesitemaps' && $usercanedit) {
|
|||||||
$xhtmllink->setAttribute("rel", "alternante");
|
$xhtmllink->setAttribute("rel", "alternante");
|
||||||
$xhtmllink->setAttribute("hreflang", "'.$shortlang.'");
|
$xhtmllink->setAttribute("hreflang", "'.$shortlang.'");
|
||||||
$xhtmllink->setAttribute("href", "'.$pageurl.'");
|
$xhtmllink->setAttribute("href", "'.$pageurl.'");
|
||||||
|
$url->appendChild($xhtmllink);
|
||||||
}
|
}
|
||||||
|
|
||||||
$root->appendChild($url);
|
$root->appendChild($url);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user