add rel canonical to mobile's URL

mxcpz
13 years, 1 month ago
HI,
I saw that after having added "mobile", 2 more URL are created.
In the example:
iphone.greenme.it/mangiare/alimentazione-a-salute/5811-frutta-rimedio-della-nonna-o-medicina-del-futurohttp://m.greenme.it/mangiare/alimentazione-a-salute/5811-frutta-rimedio-della-nonna-o-medicina-del-futuro

are created for Google, but only one is real.www.greenme.it/mangiare/alimentazione-a-salute/5811-frutta-rimedio-della-nonna-o-medicina-del-futuro

This cause a problem for indexing the main site.
Is it possible to create a rel="canonical" field for the subdomains, pointing to the main site?

Thx.
dryabov
13 years, 1 month ago
Try to add the following code to mobile templates:
 
<link rel="canonical" href="/<?php
$canonical = clone(JFactory::getURI());
$canonical->delVar('device');
$desktop_uri = new JURI($MobileJoomla_Settings['desktop_url']);
$canonical->setHost($desktop_uri->getHost());
echo $canonical->toString();
?>" />
 
mxcpz
13 years, 1 month ago
hi dryabov,
where exactly ?
dryabov
13 years, 1 month ago
E.g. just before
</head>

in index.php
dryabov
13 years, 1 month ago
I forgot to add $MobileJoomla_Settings definition. The correct code is
<link rel="canonical" href="/<?php
$canonical = clone(JFactory::getURI());
$canonical->delVar('device');
$MobileJoomla_Settings =& MobileJoomla::getConfig();
$desktop_uri = new JURI($MobileJoomla_Settings['desktop_url']);
$canonical->setHost($desktop_uri->getHost());
echo $canonical->toString();
?>" />
Adelo
11 years, 10 months ago
Hi dryabov .
I just want to say that SEO optimization is really important think , and if it possible  add function for tag  rel="canonical" , that will allow users add this tag from admin .
Thanks .







Toprecepty.ru !! Salatcezar.ru
dryabov
11 years, 10 months ago
MobileJoomla adds rel="canonical" tag to all mobile templates (this feature was added a year ago in MJ 1.0 RC5).
Adelo
11 years, 10 months ago
Thanks dryabov .
I didn't know about it .
Dhanishta
11 years, 9 months ago
Canonical tags tell the search engine bots which pieces of content are the original or primary ones and which are duplicates.In Joomla website,"rel=canonical" tag is for SEO improvement.

By continuing to use this site you consent to the use of cookies on your device as described in our cookie policy unless you have disabled them. This site will not function correctly without cookies.

I accept cookies from this site.