Update Translatable::MetaTags() to fix hreflang tags issue when page link has get params

This commit is contained in:
Priyashantha 2018-06-04 12:19:46 +05:30 committed by priyashantha
parent bb4d553b9c
commit b76859b194

View File

@ -1572,6 +1572,13 @@ class Translatable extends DataExtension implements PermissionProvider {
* @return string HTML
*/
function MetaTags(&$tags) {
if (
($controller = Controller::curr())
&& count($controller->getRequest()->getVars())
) {
$tags .= '<link rel="canonical" href="'.$controller->AbsoluteLink().'" />';
return;
}
$template = '<link rel="alternate" type="text/html" title="%s" hreflang="%s" href="%s" />' . "\n";
$translations = $this->owner->getTranslations();
if($translations->count()) {