Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Use this page as the 'home page' for the following domains


Go to End
Reply


9 Posts   2257 Views

Avatar
Chris_Bryer

Community Member, 35 Posts

23 February 2012 at 5:00pm

Hey Jason,
thanks for the feedback and the patch. i just took a look and this is actually a bug with the Translatable class in SS 2.3+. it uses similar code to put in the faulty links in the page:

function MetaTags(&$tags) {
      $template = '<link rel="alternate" type="text/html" title="%s" hreflang="%s" href="%s" />' . "\n";
      $translations = $this->owner->getTranslations();
      if($translations) foreach($translations as $translation) {
         $tags .= sprintf($template,
            $translation->Title,
            i18n::convert_rfc1766($translation->Locale),
            $translation->Link()
         );
      }
   }

if it was changed to write in $translation->AbsoluteLink() it would be correct, but Link() essentially gives a relative link. i just made a patch and sent a pull request for the Translatable module for Silverstripe 3.0, so we wouldnt need this patch in the future. For 2.4, we could either add this to SingleLocaleDomain so it removes code then adds code, or we could write another class that extends translatable and use it in place of translatable, then override the Metatags function in the Translatable extension. either way i'll probably have to branch the development in github. (now that i think about it, i think they are changing decorators in SS3.0 too so i'd probably have to do that sometime anyways).

any thoughts here? i'm tempted to override Translatable instead to fix the root cause of the problem.

thanks again for the patch and letting me know about the issue.
-Chris

Go to Top