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
-
Website Migration - Very Technical Google "Index" Question
This is my understanding of how Google's search works, and I am unsure about one thing in specifc: Google continuously crawls websites and stores each page it finds (let's call it "page directory") Google's "page directory" is a cache so it isn't the "live" version of the page Google has separate storage called "the index" which contains all the keywords searched. These keywords in "the index" point to the pages in the "page directory" that contain the same keywords. When someone searches a keyword, that keyword is accessed in the "index" and returns all relevant pages in the "page directory" These returned pages are given ranks based on the algorithm The one part I'm unsure of is how Google's "index" connects to the "page directory". I'm thinking each page has a url in the "page directory", and the entries in the "index" contain these urls. Since Google's "page directory" is a cache, would the urls be the same as the live website? For example if webpage is found at wwww.website.com/page1, would the "page directory" store this page under that url in Google's cache? The reason I ask is I am starting to work with a client who has a newly developed website. The old website domain and files were located on a GoDaddy account. The new websites files have completely changed location and are now hosted on a separate GoDaddy account, but the domain has remained in the same account. The client has setup domain forwarding/masking to access the files on the separate account. From what I've researched domain masking and SEO don't get along very well. Not only can you not link to specific pages, but if my above assumption is true wouldn't Google have a hard time crawling and storing each page in the cache?
Technical SEO | | reidsteven750 -
Rel Canonical ? please help
Can some one please answer a question for me, I have a crawl error stating that I have [#### Rel Canonical 326](http://pro.seomoz.org/campaigns/243472/issues/18) Can you please advise me on how serious these Errors are? I was told by one person not to worry but It seems far to many to me. thanks
Technical SEO | | Chris__Chris0 -
Duplicate Page Content / Rel Canonical
Hi, The diagnostics shows me that I have 590 Duplicate Page Content , but when it shows the Rel Canonical I have over 1000, so dose that mean I have no Duplicate Page Content problem? Please help.
Technical SEO | | Joseph-Green-SEO0 -
Accidentally checked privacy setting in WP to "not to index" and dropped rank...how can I fix this?
I recently rebuilt a static website to a wordpress site...In the privacy settings ....the -"Ask search engines not to index this site" was checked and I didn't notice. I had a top ranking website now its completely gone off google and every where else. I have unchecked it, resubmitted a sitemap to google.....does anyone know if this is permanent damage or if there is something else I can do to help fix this......I'm freaking out
Technical SEO | | eversseo0 -
Adding Rel Canonical to multiple pages
Hi, Our CMS generates a lot of duplicate content, (Different versions of every page for 3 different font sizes). There are many other reasons why we should drop this current CMS and go with something else, and we are in the process of doing that. But for now, does anyone know how would I do the following: I've created a spreadsheet that contains the following: Column 1: rel="canonical" tag for URL Column 2: Duplicate Content URL # 1 Column 3: Duplicate Content URL # 2 Column 4: Duplicate Content URL # 3 I want to add the tag from column 1 into the head of every page from column 2,3, and 4. What would be a fast way to do this considering that I have around 1800 rows. Check the screenshot of the builtwith.com result to see more information about the website if that helps. Farris bxySL
Technical SEO | | jdossetti0 -
Should I change these "Overly dynamic URLs" ?
Hello, My client have pages that look like this: www.domain.com/blog/index.aspx?blogmonth=1&blogday=10&blogyear=2012&blogid=256 Question 1: SEOMoz say they are overly dynamic. Is it really in this case as the numbers indicate the year, month and day and do not change? Question 2: Should we change the URLs to proper SEO friendly URLs such as www.domain.com/keywords1-keyword2? The pages are already ranking well and we worry that changing the URL may damage the ranking? Do we risk the page to go down in ranking by creating SEO friendly URLs? (and using a 301 to redirect from the old URL)
Technical SEO | | DavidSpivac0 -
Rel="canonical" and rewrite
Hi, I'm going to describe a scenario on one of my sites, I was wondering if someone could tell me what is the correct use of rel="canonical" here. Suppose I have a rewrite rule that has a rule like this: RewriteRule ^Online-Games /main/index.php So, in the index file, do I set the rel="canonical" to Online-Games or /main/index.php? Thanks.
Technical SEO | | webtarget0 -
If you only want your home page to rank, can you use rel="canonical" on all your other pages?
If you have a lot of pages with 1 or 2 inbound links, what would be the effect of using rel="canonical" to point all those pages to the home page? Would it boost the rankings of the home page? As I understand it, your long-tail keyword traffic would start landing on the home page instead of finding what they were looking for. That would be bad, but might be worth it.
Technical SEO | | watchcases0