Welcome, Guest
Username Password: Remember me

add rel canonical to mobile's URL
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: add rel canonical to mobile's URL

add rel canonical to mobile's URL 12 years, 6 months ago #5884

  • mxcpz
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
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.

Re: add rel canonical to mobile's URL 12 years, 6 months ago #5885

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4866
  • Karma: 105
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();
?>" />
 

Re: add rel canonical to mobile's URL 12 years, 6 months ago #5887

  • mxcpz
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
hi dryabov,
where exactly ?

Re: add rel canonical to mobile's URL 12 years, 6 months ago #5888

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4866
  • Karma: 105
E.g. just before
</head>

in index.php

Re: add rel canonical to mobile's URL 12 years, 6 months ago #5891

  • mxcpz
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
hmm doesn't seem to work

</script><script type="text/javascript" src="iphone.greenme.it/plugins/system/pc_includes/ajax_1.2.js"></script>  <link rel="canonical" href="/vivere/arte-e-cultura/6023-the-boat-project-la-barca-realizzata-dal-riciclo-del-legno-e-dei-ricordi-di-ciascuno-di-noi" />

Re: add rel canonical to mobile's URL 12 years, 6 months ago #5993

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4866
  • Karma: 105
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();
?>" />

Re: add rel canonical to mobile's URL 11 years, 3 months ago #13588

  • Adelo
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
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
Last Edit: 5 years ago by Adelo.

Re: add rel canonical to mobile's URL 11 years, 3 months ago #13590

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4866
  • Karma: 105
MobileJoomla adds rel="canonical" tag to all mobile templates (this feature was added a year ago in MJ 1.0 RC5).

Re: add rel canonical to mobile's URL 11 years, 2 months ago #13617

  • Adelo
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
Thanks dryabov .
I didn't know about it .

Re: add rel canonical to mobile's URL 11 years, 2 months ago #13771

  • Dhanishta
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Karma: 0
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.
  • Page:
  • 1
Time to create page: 0.34 seconds

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.