Reputation: 275
I am trying to display a rel="canonical" link in the header of a joomla 1.5 site when there is no translation for the main content.
I have succeeded in adding rel="alternative" pointing to the other languages by modifying the language selector module.
What I need to know is where in the joomfish code I can check to see if the main content is translated and and my code for the header.
I have looked in plugins->missing translation.php, and added the following code:
$doc=&JFactory::getDocument();
$getVars = JRequest::get( 'GET' );
$getVars['lang']='en';
$newURL = http_build_query($getVars);
$alternative=JRoute::_($newURL);
$customrel='<link rel="canonical" href="'.$alternative.'" />';
$doc->addCustomTag( $customrel );
The tag gets displayed in the head, but multiple times. I think this is to do with no translation results for menu items, modules and so on, so the code gets executed for each item. I just want it to execute for the main content item (be it com_content, or another component)
Thanks in advance
Upvotes: 1
Views: 190