What is the correct code to write the rel=canonical in the HTML HEAD of the page?
-
is it like:
html>
<head>
<link rel="canonical" href="http://example.com/" />
head>
<body>
...<ref>sdfdfref>
or like:
-
Yes, it's correct!
-
Hi there,
In the first example, there is a mistake: the ending sign finish like this ' /> ' and it should finish like any other tag in HTML: like this ' > ' (in both, without the ' ' )
And what Chris says is right, the first points to the homepage and the second one to a specific page.
Best Luck.
GR. -
The first example would be the correct way to apply the code to your homepage. The second example you would want to apply to a specific page that the /wordpress/seo-plugin directs to. Just keep in mind that most of your pages are going to have a unique canonical tag, which can become overwhelming to apply manually. I see you referenced WordPress above, if your site is being hosted on WordPress, I would recommend installing the Yoast plug-in. Yoast will take care of all canonicals for you.
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
-
NoIndex or Rel=Canonical Pagination
Hello, I had a question about noindex and Rel=Canonical on category page pagination. On my site, the category page the meta="robots" has "Index,Follow" tags and the rel="canonical" is the main category page, but when a user sorts the page the meta="robots" changes to "NoIndex, Follow." My question is should the sorted page be name="robots" content="INDEX,FOLLOW" /> since the rel="canonical" is pointing to the main page?? Or does it matter that it is NoIndex?? Any thoughts on this topic would be awesome. Thanks. Main Category Page
On-Page Optimization | | chuck-layton
https://www.site.com/category/
name="robots" content="INDEX,FOLLOW" />
rel="canonical" href="https://www.site.com/category/"/> Name Sorted Page
https://www.site.com/category/?dir=asc&order=name
name="robots" content="NOINDEX, FOLLOW" />
rel="canonical" href="https://www.site.com/category/">0 -
With generic product like screws, for example what is best practice when writing descriptions? It's tough writing unique content for something when the only difference is lengths
With generic product like screws, for example what is best practice when writing descriptions? It's tough writing unique content for something when the only difference is lengths
On-Page Optimization | | Jacksons_Fencing1 -
123 keywords for a page
Hey mOz fans , I have a site that has 130 keywords. can ı target this amount just incoperate them as Ryan discussed Before.
On-Page Optimization | | atakala0 -
Noindex pages being indexed
Hi all Wondering if anyone could offer a pointer on a problem i am having please. I am developing an affiliate store and to prevent problems with duplicate content I have added name="robots" content="NOINDEX,FOLLOW" /> to all the product pages to avoid google penalties. However, Google appears to be indexing product pages. When I do a site: search I see a few hundred product pages in the engine. This is odd as the site has always had noindex on these pages. Even viewing the cache of the indexed page shows the noindex meta tag to be in place. I'm at a loss as to why these pages are being indexed and could do with removing them asap to stop any penalties on the site. Many thanks for any help.
On-Page Optimization | | carl_daedricdigital0 -
Canonical tags
In previous we had issues with capital letters in page urls. So we made a 301 redirection to lower case page url. But I read there that it's not good idea to use 301 redirection, better solution for that canonical tag. So we placed canonical url tak to lower case page url... So after week, in google webmaster tools I see around 60k os dublicate pages. Why google don't see canonical tag? Thank you
On-Page Optimization | | bele0 -
Too Many On-Page Links
Hi All, New to SEOMoz, so thanks in advance for any answers! Looking at our Crawl Diagnostics and "Too Many On-Page Links" is first on the list. The site was build with the intention of users being able to quickly get to where they want to go with drop down menus (sub nav), so we built the navigation using bullet points/css. Yes, agreed there are too many links on each page from our navigation, main nav cats are 4 with sub nav about 40, but what is the best way to resolve the problem other then removing most of the links (from the sub nav drop down)? Could we just use the attribute rel=nofollow for the sub nav links? TIA
On-Page Optimization | | bmmedia0 -
Rel Canonical
Hi Folks I have 77 Rel Canonical warning, and mostly confuse me. Mainly because they seem to be the exact link I would expect for that page. So I'm not so sure why they have been flagged.... two examples below Any thoughts or tips? (please 🙂 ) | Page Title
On-Page Optimization | | PHDAustralia68
URL | Tag value | Page Authority | Linking Root Domains | | BlueTea: New Sydney Kitchen Designs Company, Renovations, Colour Designs http://bluetea.com.au/ bluetea.com.au/ 37 18 Blog | Blue Tea http://bluetea.com.au/2010/10/?cat=15 | bluetea.com.au/category/blog/ | 1 | 0 |
| |0 -
Rel Canonical
I will be quick and to the point. I am clearly a novice. I received a notice on my seomoz account that I had 12 pages with a Rel Canonical issue. It seems serious. Can this be a quick fix? Any thoughts? Below is the site address. petbarnpdx.com Thanks in advance for any input on this! Dave
On-Page Optimization | | APICDA0