PDA

View Full Version : Canonical URLs link (tags) plugin



PGGO
April 27, 2012, 04:50 AM
Canonical URL link (tag) in between head sections of the HTML code, will benefit website for SEO purpose.
Example canonical link (tag):
<link rel="canonical" href="http://www.flynax.com/" />
OR
<link rel="canonical" href="http://www.flynax.com/features.html" />

This will reduce a duplicate content issue with search engines!
This link should be added to all important pages, such as categories.

For example:
The canonical link for the page URls below should be as following:
<link rel="canonical" href="http://www.flynax.com/features.html" />

Sample page URLs:
http://www.flynax.com/features.html
http://www.flynax.com/features.html?some_dinamic_content
http://www.flynax.com/features.html/index2
http://www.flynax.com/features.html/index3

(all the pages above; the search engine consider as the same pages. In this case, the canonical link (tag) will tell search engine where the main URL is located)

This is will avoid PENALTY of the search engines for duplicate content on the website.

ATServiceSRL
January 9, 2013, 09:26 PM
It's very simple to do :

open the header.tpl of your theme (/templates/yourtemplate/tpl/header.tpl) and search


<meta name="keywords" content="{$pageInfo.meta_keywords|strip_tags}" />

add after


<link rel="canonical" href="{$pageInfo.canonical}" />


after it, open the file common.inc.php in the includes folder, search :



/* send headers */
header("Content-Type: text/html; charset=utf-8");
header("Cache-Control: store, no-cache, max-age=3600, must-revalidate");


and add after this code:



$page_info['canonical'] = RL_URL_HOME;
$page_info['canonical'] .= $config['mod_rewrite'] ? parse_url(substr($_SERVER['REQUEST_URI'],1),PHP_URL_PATH) : "index.php?".$_SERVER['QUERY_STRING'];

Peter Jonsson
January 9, 2013, 09:48 PM
I dont really understand what this do. Is this good to implement to the site ?
Can anyone tell me in details what this do ?

ATServiceSRL
January 9, 2013, 11:03 PM
Here some informations : http://en.wikipedia.org/wiki/Canonical_link_element

Google penalizes websites where find duplicate elements. But sometimes Google arrive to one page from two or more links, and don't understand that this page is the same page.

With canonical tag you help google to understand that it's not a duplicate and save your website from penalize.

PGGO
January 10, 2013, 02:18 AM
Fabrizio,

Thank you very much!

It works great.

ATServiceSRL
January 10, 2013, 02:43 AM
You welcome ;-)

Robert Wagenaar
June 21, 2013, 08:39 AM
Hello Fabricio, I just found the thread, thanks very much for posting it! I'm having quite a lot of duplicate content from my site in Google and I'm sure this is going to help, thanks again!

Robert

Jonathan Solomon
September 5, 2014, 06:15 AM
I'm pretty sure this doesn't really work.

When I go to my website normally it produces:
<link rel="canonical" href="http://www.MyDomain.com/" />


And when I add "/index.php" to the end of the URL I see in the source:
<link rel="canonical" href="http://www.MyDomain.com/index.php" />


I can also generate:
<link rel="canonical" href="http://www.MyDomain.com/about-us.html" />

And

<link rel="canonical" href="http://www.MyDomain.com/about-us/" />


I think the whole point of canonical is to have it pick one version and always use it for the same page, so duplicates aren't indexed by google. Anyone have ideas for solving this?

Thank you

Gen82
September 5, 2014, 11:52 AM
Hi all

after it, open the file common.inc.php in the includes folder, search : includes>controllers>common.inc.php right directory
Thanks PGGO,ATServiceSRL

Jonathan Solomon
September 6, 2014, 06:29 PM
Hi Gen82,
Yes I think ATServiceSRL meant the "includes>controllers>" directory.

I tried that, but it really isn't solving the canonical issue.

There are still several URL versions of each page, all of them specifying a canonical tag that they are the true version.

Both of these pages should contain the exact same canonical tag which should specify the main version of the about us page.
http://www.MyDomain.com/about-us.html
http://www.MyDomain.com/about-us/


Also, does anyone know which is a better format, with ".html" or without? It seems like the site uses ".html". Is that best?

Thanks all.

Gen82
September 7, 2014, 01:01 AM
Hello all, Believe that dilemma will resolve our flynax team thing so. Better format, with ".html" google bot meaning fixed links directories (this my opinion).

Viktor
September 8, 2014, 05:08 AM
Hello Gen,

For listings you can enable .html for urls in Admin Panel >> Listiny Types click edit then find line: Enable .html at the end of urls
But for part links needs to add manually in then code.

Andrew Wildsmith
August 18, 2019, 03:44 AM
does this work with version 4.7.2?

Andrew Wildsmith
February 24, 2021, 10:10 AM
my code for this is in head.tpl not header.tpl does it matter can I use code in head.tpl?

Rudi
February 24, 2021, 03:34 PM
Yes, because the <head> data moved from header.tpl to head.tpl in the latest updates