English > General Questions

Alternate Meta Tags

(1/3) > >>

jstead:
Hi,

I have just launched our website using jdiction, and I have been looking into the SEO aspect of it and what multilingual brings to the game.

Sounds like the <link rel="alternate" and hreflang="" > tags play a big part in this.

Joomla core has this if you use associated menus, but as this plugin removes the need to associate menus is there an alternate way to implement these into the website?


All documentation I have found says to add something along the lines of

   <link rel="alternate" href="http://www.domain.com/us/" hreflang="en-us" />
   <link rel="alternate" href="http://www.domain.com/de/" hreflang="de" />
   <link rel="alternate" href="http://www.domain.com/es/" hreflang="es" />

which is easy enough in index.php, but is this then meant to adjust to

   <link rel="alternate" href="http://www.domain.com/us/english-name" hreflang="en-us" />
   <link rel="alternate" href="http://www.domain.com/de/german-name" hreflang="de" />
   <link rel="alternate" href="http://www.domain.com/es/spanish-name" hreflang="es" />

etc for other pages?

If so can this data be pulled from the Jdiction data on the fly in anyway? ie.

   <link rel="alternate" href="<current URL>" hreflang="<current lang tag>" />
   <link rel="alternate" href="<german equivilant link>" hreflang="<german tag>" />
   <link rel="alternate" href="<spanish equivilant link>" hreflang="<spanish tag>" />

Any advise/tips from anyone that has done this aspect of a multilingual site before would be appreciated.

Regards,
Jason

Harald Leithner:
The jDiction plugin add these headers automatically. There is an option to disable it but by default this is on (iirc).

check the code on jdiction.org


--- Code: ---<link href="/en/" rel="alternate" type="text/html" hreflang="en-GB" lang="en-GB" title="News" />
--- End code ---

jstead:
ok great, found the setting within the jdlanguage module... Had been looking in the plugins.

Would it be hard to modify some of them to just the 2 digit ISO code, or are these taken straight from the joomla language file?

ie: de-DE would target not just the German language, but Germany as well.
    Where as de would target anyone who speaks German.


Also, it is mentioned that you should also show this tag for the language of the page your on as well, not just the others.
Would this be possible to add manually if I knew which files to edit?


Thanks,
Jason

jstead:
Hi Harald,

Just wondering if there was a specific file I could modify, to change how the hreflang is displayed.

Was hoping to add a little if statement for some of them that changes them from 4 digit ISO code to 2 digits.

Would this modification even be possible?

Thanks,
Jason

Harald Leithner:
you can find it in the modules folder.

modules\mod_jdlanguage\mod_jdlanguage.php


--- Code: ---$doc->addHeadLink($lang->link, 'alternate', 'rel', array(
'type' => 'text/html',
'hreflang' => $lang->lang_code,
'lang' => $lang->lang_code,
'title' => $lang->menutitle
));

--- End code ---

changing to


--- Code: ---$doc->addHeadLink($lang->link, 'alternate', 'rel', array(
'type' => 'text/html',
'hreflang' => substr($lang->lang_code, 0, 2),
'lang' => $lang->lang_code,
'title' => $lang->menutitle
));

--- End code ---

should work.

Navigation

[0] Message Index

[#] Next page

Go to full version