hi everyone
i just read through this post about the canonical tag which I found really useful
still, i think there is a major and important rule is missing, which is, the proper use of the canonical tag
in almost all the posts there are discussions, solutions about how to add or generate the canonical tag automaticaly for each individual page, but the proper use and scope of the canonical tag is missing
so, I decided to share with you my case and the main principles of proper use of the canonical tag
basically, a canonical tag is needed when a certain page is accessible through more path ie more URL addresses
here is an ex:
URL1: www.example.com/category01/product03 (main page)
URL2: www.example.com/category02/product03 (Symlink)
URL3: www.example.com/category03/product03 (Symlink)
Since the product03 page is related to more categories, it is accessible through more URL addresses (each of them showing same content)
Now we have to decide which one to be the main page, the one to which the other two’s canonical tag would point to.
By only implementing your solutions, it would result that each page would have a canonical pointing to ITSELF, which you all know, would not be enough.
Here it is what I am using on my site:
- first, I have created the main page for my product (let’s suppose URL1)
- secondly I created two symlinks of the main page under the other two categories (the Symlinks would load same content as the main page under URL1)
- in the third stage I created a TV named canonicalTag with the following settings:
Input Type: Tag
Default value: <link rel="canonical" href="[[~[[*id]]? &scheme=`full`]]" />
Output type: Default
- and as the fourth step was to add the call action of this tag in the header section (in my case in the Templates I use)
<head profile="http://www.w3.org/profile/html-rdfa-1.1">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>[[*pagetitle]] - [[++site_name]]</title>
[[*canonicalTag]]
<meta name="description" content="[[*description]]" />
..........
</head>
When all this is done, all I had to do is to change the default canonical value of the Symlinks under Template Variable tab when editing these symlink pages. If not changed, then it would have pointed to themselves. So the manually added canonical tags for these two symlink pages would be:
<link rel="canonical" href="http://www.example.com/category01/product03"/>
which as you can see points to the main page (URL1)
I hope some of you will find my ex useful especially the part of using the canonical tag properly and what its purpose actually is, that of filtering duplicate content and path link value to the main page.
regards