Fix no hreflang if not a canonical page
This commit is contained in:
parent
5f3a82423f
commit
7c92bb218e
@ -157,9 +157,14 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
|
|||||||
$tplcontent .= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
|
$tplcontent .= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
|
||||||
$tplcontent .= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.' (https://www.dolibarr.org)" />'."\n";
|
$tplcontent .= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.' (https://www.dolibarr.org)" />'."\n";
|
||||||
$tplcontent .= '<meta name="dolibarr:pageid" content="'.dol_string_nohtmltag($objectpage->id).'" />'."\n";
|
$tplcontent .= '<meta name="dolibarr:pageid" content="'.dol_string_nohtmltag($objectpage->id).'" />'."\n";
|
||||||
|
// Add canonical reference
|
||||||
|
if ($object->virtualhost) {
|
||||||
|
$tplcontent .= '<link rel="canonical" href="'.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php')).'" />'."\n";
|
||||||
|
}
|
||||||
// Add translation reference (main language)
|
// Add translation reference (main language)
|
||||||
if ($object->isMultiLang()) {
|
if ($object->isMultiLang()) {
|
||||||
// Add myself
|
// Add myself
|
||||||
|
$tplcontent .= '<?php if ($_SERVER["PHP_SELF"] == "/'.$objectpage->pageurl.'.php") { ?>'."\n";
|
||||||
$tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '')).'/'.$objectpage->pageurl.'.php').'" />'."\n";
|
$tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '')).'/'.$objectpage->pageurl.'.php').'" />'."\n";
|
||||||
|
|
||||||
// Add page "translation of"
|
// Add page "translation of"
|
||||||
@ -194,10 +199,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
}
|
$tplcontent .= '<?php } ?>'."\n";
|
||||||
// Add canonical reference
|
|
||||||
if ($object->virtualhost) {
|
|
||||||
$tplcontent .= '<link rel="canonical" href="'.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php')).'" />'."\n";
|
|
||||||
}
|
}
|
||||||
// Add manifest.json on homepage
|
// Add manifest.json on homepage
|
||||||
$tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n";
|
$tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user