Rel="canonical" again
-
Hello everyone,
I should rel="canonical" my 2 languages website /en urls to the original version without /en. Can I do this from the header.php? Should I rel="canonical" each /en page (eg. en/contatti, en/pagina) separately or can I do all from the general before the website title?
Thanks if someone can help.
-
So, if I understood, my code to have in the header.php of the website should be:
hope im right :)
-
NetLogiQ Thank you.
This answer solves a lot of tricks i had in my head
Thank you very much, I will better study the link you sent, and try to implement on my website. Footers etc. are not translated, so they remain in the original language.. But while reading, I think the solution can fit to my problem.
Thanks again!
Eugenio
-
Hi,
As I see it, you don't need to use a rel="Canonical" because your pages are not duplicates. You have content in italian and translated content in English.
The only thing you need to do is add a rel="alternate" hreflang="x"
This is what Google recommends in case your website is fully translated.
Some example scenarios where
rel="alternate" hreflang="x"
is recommended: For example, you have both German and English versions of each page. Here is how you implement it: https://support.google.com/webmasters/answer/189077?hl=en1. Add a HTML link in the header - section for example:
2. HTTP header. If you publish non-HTML files (like PDFs), you can use an HTTP header to indicate a different language version of a URL: Link: <http: www.yourwebsite.eg="" en="">; rel="alternate"; hreflang="en".</http:>
-
hello james
Thanks for reply. I have original webpages in Italian. Translated webpages are in English. I use a plugin for wordpress, that allows me to translate the whole page (title, etc.) except the url, which will only be different because of the /en before the original page name (in italian, eg /en/contatti)
Widgets, footers etc. are still in Italian, even with translated pages.
I also thought about changing permalinks to be %postname%, so that url may adapt to title (? I think). But Im afraid this website wide urls change will affect my current rankings.
Any suggestion?
-
This is a response to both questions. Rel = canonical will give in this case the English page the authority, that should be the page that ranks well.
The main issue here is if the whole page is translated don't use a canonical tag, if the content stays in English and the Navigation/footer is changed use canonical tag to the English page as this would verge on duplicate content.
-
in fact, now that im thinking:
will not canonical confuse google if trying to rank also for the other language?
What will appear? this is duplicate in a sense, but is complete different content in the other sense.
Please correct me if im wrong..
-
this is what google replied to the same question, not very explicit at all!
"Canonical was not created to say that a language is another language, but that a duplicate page is just a variation and not the original page"
Im lost again but i also now think that rel canonical is the solution..
-
Just to add in here and simplify the process, Wordpress has a built in function to return the current post/page URL. Make use of 'get_permalink()', with some simply string manipulation you would be able to output the correct canonical tag to your page.
Edit: My PHP is a little rusty at times, but the following should sort you out:
//Check if the page you're on is a single post. If so run below.
if ( is_single() ) {
$url = get_permalink();
$canonical = str_replace('/en', '', $url);echo '';
};
?>As mentioned above, put this into your header.php file (in the template directory), where you would like the canonical tag to appear.
-
He isn't trying to redirect he does want both pages.
Also canonical sitewide is problematic unless you add a customized conditional at the PHP level. He has a wordpress site and can't edit the raw HTML of every page so he needs to have a PHP string at the global level which changes based on page variables.
-
Hello,
1. Do not add a canonical sitewide tag - here is a case study on why http://moz.com/blog/catastrophic-canonicalization Long story short - he deindexed 57% of his website.
2. You could 301 redirect all the pages, instead of adding a rel canonical. If your /en version is a duplicate of the original version, then you could simply add a code that redirects each page to the relevant version, like this: RedirectMatch 301 ^/en/(.*)$ http://www.yourwebsite.en/$1
You can use that solution in the case where you have a website called www.mywebsite.com that has a www.mywebsite.com/en version for a lot of links if not all, and those are the ones indexed in Google. You just add that code into htaccess. So just replace mywebsite with your website.
-
I don't want to post the same answer as I did to your previous question but perhaps there was further clarification that you needed, that I missed!
Put a conditional in the header. Since you are using a wordpress platform you can't go in and manually edit each pages canonical anyway. Using the page if function and a variable you would be able to assign each one it's own rel= from a central head file anyway.
In an ideal situation you'd do each page manually but because of your CMS you need to do a work around
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
-
Rel=canonical or 301 to pass on page authority/juice
I have a large body of product support documentation and there are similar pages for each of versions of the product, with minor changes as the product changes. The two oldest versions of this documentation get the best ranking and are powering Google snippets--however, this content is out of date. The team responsible for the support documentation wants current pages to rank higher. I suggested 301 redirects but they want to maintain the old page content for clients still using the older version of the product. Is there a way to move a page's power to a more updated version of the page, but without wiping out the old content? Considering recommending canonical tags, but I'm not sure this will get me all the way there either as there are some differences between pages, especially as the product has changed over time. Thoughts?
Technical SEO | | rachelholdgrafer0 -
Does using data-href="" work more effectively than href="" rel="nofollow"?
I've been looking at some bigger enterprise sites and noticed some of them used HTML like this: <a <="" span="">data-href="http://www.otherodmain.com/" class="nofollow" rel="nofollow" target="_blank"></a> <a <="" span="">Instead of a regular href="" Does using data-href and some javascript help with shaping internal links, rather than just using a strict nofollow?</a>
Technical SEO | | JDatSB0 -
Rel=Canonical Help
The site in question is www.example.com/example. The client has added a rel=canonical tag to this page as . In other words, instead of putting the tag on the pages that are not to be canonical and pointing them to this one, they are doing it backwards and putting the same URL as the canonical one as the page they are putting the tag on. They have done this with thousands of pages. I know this is incorrect, but my question is, until the issue is resolved, are these tags hurting them at all just being there?
Technical SEO | | rock220 -
Canonical Question
Can someone please help me with a question, I am learning about Canonical URls at the moment and have had some errors come up, it is saying ```![Priority 1](http://try.powermapper.com/Reports/89db420a-2cf2-46dc-bae4-543efbefc241/report/Report/p1.png)This page has multiple rel=canonical tags.Line 9 Best Practice[![](http://try.powermapper.com/Reports/89db420a-2cf2-46dc-bae4-543efbefc241/report/Report/dropbox.png)](http://try.powermapper.com/Reports/89db420a-2cf2-46dc-bae4-543efbefc241/report/res/2.view.htm#)![Help](http://try.powermapper.com/Reports/89db420a-2cf2-46dc-bae4-543efbefc241/report/Report/help.png)Search engine behavior is unpredictable when a page has multiple canonical tags. <link rel="canonical" href="http://www.finalduties.co.uk/" /><link rel="alternate" type="application/rss+xml" title="Final Duties – Low cost probate RSS Feed" href="http://www.finalduties.co.uk/feed/" /> <link rel="alternate" type="application/atom+xml" title="Final Duties – Low cost probate Atom Feed" href="http://www.finalduties.co.uk/feed/atom/" /><link rel="pingback" href="http://www.finalduties.co.uk/xmlrpc.php" />That canonical link to Feed? should that be there, I know the Plugin has done this but I am lost to what should be there, I have no duplicate pages as far as I am aware than needs a canonical URL ??Thanks ``` >
Technical SEO | | Chris__Chris0 -
Why am I getting rel= canonical?
I'm getting 14 rel=canonical tags on my site. Could someone offer me an insight as to this is happening? http://cool-invent.com Thanks, Lorraine
Technical SEO | | coolinvent0 -
Moz Crawl Reporting Duplicate content on "template" styled pages
We have a lot of detail pages on our site that reference specific scholarships. Each page has a different Title and Description. They also have unique information all regarding the same data points. The pages are displayed in a similar structure to the user so the data is easy to read. My problem is a lot of these pages are being reported as duplicate content when they certainly are not. Most of them are reported as duplicates when they have the same sponsor. They may have the same contact information listed. These two are being reported as duplicate of each other. They share some data but they are definitely different scholarships. http://www.collegexpress.com/scholarships/adelaide-mcclelland-garden-club-scholarship/9254/ http://www.collegexpress.com/scholarships/mary-wannamaker-witt-and-lee-hampton-witt-memorial-scholarship/10785/ Would it help to add a Canonical for each page to themselves? Any other suggestions would be great. Thanks
Technical SEO | | GeorgeLaRochelle0 -
What to do about "blocked by meta-robots"?
The crawl report tells me "Notices are interesting facts about your pages we found while crawling". One of these interesting facts is that my blog archives are "blocked by meta robots". Articles are not blocked, just the archives. What is a "meta" robot? I think its just normal (since the article need only be crawled once) but want a second opinion. Should I care about this?
Technical SEO | | GPN0 -
I have both a ".net" and a ".com" address for the Same Website.....
I have mysite.net and mysite.com......They are both the same age, however, we always had it so that the mysite.com address forwarded to the mysite.net address. The mysite.net address was our main address forever. We recently reversed that and made the mysite.com address the main address and just have mysite.net forward to the mysite.com address. I'm wondering if this change will affect our rankings since a lot of the backlinks we've acquired are actually pointing to mysite.net and not mysite.com (our new main address)???
Technical SEO | | B24Group0