From fe2a7d64ed44ac874a85484835113b08a29e860f Mon Sep 17 00:00:00 2001 From: Micah Sheets Date: Mon, 14 Aug 2017 12:50:56 -0700 Subject: [PATCH] Update Translatable.php --- code/model/Translatable.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/code/model/Translatable.php b/code/model/Translatable.php index cceea13..d77f84b 100755 --- a/code/model/Translatable.php +++ b/code/model/Translatable.php @@ -1740,6 +1740,22 @@ class Translatable extends DataExtension implements PermissionProvider ); } } + else { + // Added to comply with current Google recommendations + // If no translations found for this page, add a self referencing hreflang tag so Google does not complain + // Language and Local tag + $tags .= sprintf($template, + Convert::raw2xml($this->owner->Title), + i18n::convert_rfc1766($this->owner->Locale), + $this->owner->AbsoluteLink() + ); + // Language only tag + $tags .= sprintf($template, + Convert::raw2xml($this->owner->Title), + i18n::get_lang_from_locale($this->owner->Locale), + $this->owner->AbsoluteLink() + ); + } } public function providePermissions()