What is the proper syntax for rel="canonical" ??
-
I believe the proper syntax is like this [taken from the SEOMoz homepage]:
However,
one of the sites I am working on has all of their canonical tags set up like this:
I should clarify, not all of their canonicals are identical to this one, they simply use this naming convention, which appears to be relative URLs instead of absolute.
Doesn't the entire URL need to be in the tag? If that is correct, can you also provide me with an explanation that I can give to management please? They hate it when I say "Because I said so!" LOL
-
Thanks Dr. Pete! An you know what? You are absolutely right. Google has interpreted the canonical just that way and it's been in our GWT reports forever and no one could figure out where they were coming from.
Thank you, thank you, thank you (in my Gomer Pyle voice, of course!)
Wow, it's amazing how fixing one thing can sometimes take you down a whole nother road and fix something else at the same time. I just can't thank both you and George enough.
Kudos to George on a great answer.
-
Endorsing George for the full thread. Technically, Google does allow relative URLs, but I've heard of some odd issues, so I think it's better to use full URLs. Your home-page version isn't really either an absolute or relative URL - you really should have the "http://" (protocol) in that URL. If you're being nitpicky, that's an improper URL, and Google could end up interpreting it as something like:
http://www.ccisolutions.com/www.ccisolutions.com
Now, odds are, they won't, but with these tags it's really best to do it by the book.
-
No problem, glad to help!
-
Agreed. I think if we can change the Storefront to storefront without having to employ any kinds of redirects it would be great. Otherwise, the site is so old, that it may not matter.
Along those lines, we recently had the opportunity to remove /Storefront from the URL string. We chose not to because the site is 10 years old and didn't want to risk losing any page or domain authority by having a whole bunch of 301 redirects.
Certainly interested to know your take from the viewpoint of someone who knows code. Thanks George!
-
Yes, you are correct. But only if you have a base link in the document:
<base href="http://www.ccisolutions.com/">
This is a very good example for why you may want to stick to Absolute URLs. With an absolute URL you only need to know the actual URL of the page:
Hopefully I'm not adding even more to the fire, but now might be a good time to change "StoreFront" to "storefront" all lowercase. I think lowercase URLs are better if you can use them.
-
Thanks so very much George for your thorough answer. This is exactly what I needed know, and it makes it possible for me to explain it to the CEO. It appears we have a confusing mixture of absolute and relative URLs, that need to be sorted out. I think sticking with the absolutes will makes it much easier.
While we have this on the home page:
This is an example of a category page canonical tag:
Would I be correct is saying that there is a problem here because the actual URL of the page is
http://www.ccisolutions.com/StoreFront/category/wireless-microphones
So if we are going to use the relative URL in our canonical tag, it should be:
Is that correct?
-
Also just to clarify, when you state they are using "relative" URLs, are you talking about "www.ccisolutions.com/page1.html" vs. "http://www.ccisoultions.com/page1.html"?
If this is true, then both versions are absolute URLs. A relative URL is different. Here are a few examples of relative URLs:
page1.html
/products/page1.html
../products/page1.html
../images/image1.jpg
/images/image1.jpg
image1.jpg
Each of the above are "relative links". Absolute links look like the following and don't necessarily need the "http://":
www.ccisolutions.com/products/page1.html
http://www.ccisolutions.com/products/page1.html
Hope this helps too.
-
Document refers to the single web page you are placing the canonical link on.
The base link is referring to the URL you can provide as the href property for the base tag. The base tag can be included in the head of your HTML document.
Example base link:
<base href="http://www.ccisolutions.com/">
If you choose to use the example base link above and this relative URL:
Your canonical link will end up referring to “http://www.ccisolutions.com/page1.html”.
Here is a second example, this time using a new base link which includes the products directory:
<base href="http://www.ccisolutions.com/products/">
If you choose to use this new base link and the following relative URL:
Your canonical link will end up referring to “http://www.ccisolutions.com/products/page1.html”.
If you choose to use this new base link and this relative URL:
Your canonical link will actually refer to one-level-up from your base link or “http://www.ccisolutions.com/page1.html”. I'm not sure if you're familiar with the syntax "../" (dot dot slash), but it means to go up one level from the current directory.
The use of base links for canonical linking might be useful for a CMS where the content is generally dynamically created. It might be good to sit down with your developers and discuss which tactic would be best for the site in question.
I am including a link to this SEOmoz blog post in case it is also of help.
Edit: expanded on the explanations...
-
Thanks George. Can you help me with what this means on a large site "
If your document specifies a base link, any relative links
will be relative to that base link." ? Does "document" refer to the entire site, or a single Web page? Thanks!
-
Hello Dana,
I suggest reading this over: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394
Midway down the page, Google states:
Can the link be relative or absolute?
rel="canonical"
can be used with relative or absolute links, but werecommend using absolute links to minimize potential confusion or
difficulties. If your document specifies a base link, any relative links
will be relative to that base link.
Hope this helps!
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Software "card" carousel results
Hi all! Does anyone have advice for getting a software product to appear in the card results at the top of SERPs? Example https://www.google.com/search?q=budgeting+software&rlz=1C1CHBF_enUS784US784&oq=budgeting+software&aqs=chrome..69i57j0l5.2194j0j7&sourceid=chrome&ie=UTF-8 dzTpe2B
Intermediate & Advanced SEO | | SimpleSearch0 -
Rel language
This site ranks well in the States and Austraila. Would rel language tags help with search for both states? https://www.dinkleboo.com/ Separating duplicate content. Or how would you go about increasing ranking? The site ranks higher in the states than Austrailia but they want to increase their presence in AU. US Position 4.9k AU Position 1.3
Intermediate & Advanced SEO | | AaronRainsSEO0 -
Is there a way to rel = canonical only part of a page?
Hi guys: I'm doing SEO for a boat accessories store, and for instance they have marine AC systems, many of them, and while the part number, number of BTUs, voltage, and accessories change on some models, the description stays exactly the same across the board on many of them...people often search on Google by model number, and I worry that if I put rel = canonical, then the result for that specific model they're looking for won't come up, just the one that everything is being redirected to. (and people do this much more than entering a site nowadays and searching by product model, it's easier). Excuse my ignorance on this stuff, I'm good with link building and content creation, but the behind-the-scenes aspects... not so much: Can I "rel=canonical" only part of the page of the repeat models (the long description)? so people can still search by model number, and reach the model they are looking for? Am I misunderstanding something here about rel=canonical (Interesting thing, I rank very high for these pages with tons of repeat descriptions, number one in many places... but wonder if google attributes a sort of "across the site" penalty for the repeated content... but wouldn't ranking number 1 for these pages mean nothing's wrong?. Thanks)
Intermediate & Advanced SEO | | DavidCiti1 -
Using a lot of "Read More" Hidden text
My site has a LOT of "read more" and when a user click they will see a lot of text. "read more" is dark blue bold and clear to the user. It is the perfect for the user experience, since right below I have pictures and videos which is what most users want. Question: I expect few users will click "Read more" (however, some users will appreciate chance to read and learn more) and I wonder if search engines may think I am hiding text and this is a risky approach or simply discount the text as having zero value from an SEO perspective? Or, equally important: If the text was NOT hidden with a "Read more" would the text actually carry more SEO value than if it is hidden under a "read more" even though users will NOT read the text anyway? If yes, reason may be: when the text is not hidden, search engines cannot see that users are not reading it and the text carry more weight from an SEO perspective than pages where text is hidden under a "Read more" where users rarely click "read more".
Intermediate & Advanced SEO | | khi50 -
Add or not add "nofollow" to duplicate internal links?
Hello everyone. I have searched on these forums for an answer to my concerns, and despite I found many discussions and questions about applying or not applying "nofollow" to internal links, I couldn't find an answer specific to my particular scenarios. Here is my first scenario: I have an e-commerce site selling digital sheet music, and on my category pages our products are shown typically with the following format: PRODUCT TITLE link that takes to product page Short description text "more info" link that takes to the same product page again As you may notice, the "more info" link takes at the very same page of the PRODUCT TITLE link. So, my question is: is there any benefit to "nofollow" the "more info" link to tell SEs to "ignore" that link? Or should I leave the way it is and let the SE figure it out? My biggest concern by leaving the "nofollow" out is that the "more info" generic and repetitive anchor text could dilute or "compete" with the keyword content of the PRODUCT TITLE anchor text.... but maybe that doesn't really matter! Here a typical category page from my site; http://www.virtualsheetmusic.com/downloads/Indici/Guitar.html My second scenario: on our product pages, we have several different links that take to the very same "preview page" of the product we sell. Each link has a different anchor text, and some other links are just images, all taking to the same page. Here are the anchor texts or ALT text of such same links: "Download Free Sample" (text link) "Cover of the [product title]" (ALT image text) "Look inside this title" (ALT image text) "[product title] PDF file" (ALT image text) "This item contains one high quality PDF sheet music file ready to download and print." (ALT image text) "PDF" (text link) "[product title] PDF file" (ALT image text) So, I have 7 links on the same product page taking the user to the same "product preview page" which is, by the way, canonicalized to the "main" product page we are talking about. Here is an example of product page on my site: http://www.virtualsheetmusic.com/score/Moonlight.html My instinct is to tell SEs to take into account just the links with the "[product title] PDF file" anchor text, and then add a "nofollow" to the other links... but may that hurting in some way? Is that irrelevant? Doesn't matter? How should I move? Just ignore this issue and let the SEs figure it out? Any thoughts are very welcome! Thank you in advance.
Intermediate & Advanced SEO | | fablau0 -
Canonical VS Rel=Next & Rel=Prev for Paginated Pages
I run an ecommerce site that paginates product pages within Categories/Sub-Categories. Currently, products are not displayed in multiple categories but this will most likely happen as time goes on (in Clearance and Manufacturer Categories). I am unclear as to the proper implementation of Canonical tags and Rel=Next & Rel=Prev tags on paginated pages. I do not have a View All page to use as the Canonical URL so that is not an option. I want to avoid duplicate content issues down the road when products are displayed in multiple categories of the site and have Search Engines index paginated pages. My question is, should I use the Rel=Next & Rel=Prev tags on paginated pages as well as using Page One as the Canonical URL? Also, should I implement the Canonical tag on pages that are not yet paginated (only one page)?
Intermediate & Advanced SEO | | mj7750 -
Canonical URLs and Sitemaps
We are using canonical link tags for product pages in a scenario where the URLs on the site contain category names, and the canonical URL points to a URL which does not contain the category names. So, the product page on the site is like www.example.com/clothes/skirts/skater-skirt-12345, and also like www.example.com/sale/clearance/skater-skirt-12345 in another category. And on both of these pages, the canonical link tag references a 3rd URL like www.example.com/skater-skirt-12345. This 3rd URL, used in the canonical link tag is a valid page, and displays the same content as the other two versions, but there are no actual links to this generic version anywhere on the site (nor external). Questions: 1. Does the generic URL referenced in the canonical link also need to be included as on-page links somewhere in the crawled navigation of the site, or is it okay to be just a valid URL not linked anywhere except for the canonical tags? 2. In our sitemap, is it okay to reference the non-canonical URLs, or does the sitemap have to reference only the canonical URL? In our case, the sitemap points to yet a 3rd variation of the URL, like www.example.com/product.jsp?productID=12345. This page retrieves the same content as the others, and includes a canonical link tag back to www.example.com/skater-skirt-12345. Is this a valid approach, or should we revise the sitemap to point to either the category-specific links or the canonical links?
Intermediate & Advanced SEO | | 379seo0 -
Shall I fix "most Common Errors" for a website that ranked top 3 on Google (difficult KW)?
How can SEOmoz "most Common Errors*" under "Crawl Diagnostics" advice can be right for a good site organic? Site is well ranked top 3 on Google (difficult KW). If I go ahead and fix these errors, I might hurt my SEO , no? like: Too Many On-Page Links 302 (Temporary Redirect) Title Element Too Long (> 70 Characters) Missing Meta Description Tag
Intermediate & Advanced SEO | | Elchanan0