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 For Landing Pages
We have PPC landing pages that are also ranking in organic search. We've decided to create new landing pages that have been improved to rank better in natural search. The PPC team however wants to use their original landing pages so we are unable to 301 these pages to the new pages being created. We need to block the old PPC pages from search. Any idea if we can use rel=canonical? The difference between old PPC page and new landing page is much more content to support keyword targeting and provide value to users. Google says it's OK to use rel=canonical if pages are similar but not sure if this applies to us. The old PPC pages have 1 paragraph of content followed by featured products for sale. The new pages have 4-5 paragraphs of content and many more products for sale. The other option would be to add meta noindex to the old PPC landing pages. Curious as to what you guys think. Thanks.
Technical SEO | | SoulSurfer80 -
"Equity sculpting" with internal nofollow links
I’ve been trying a couple of new site auditor services this week and they have both flagged the fact that I have some nofollow links to internal pages. I see this subject has popped up from time to time in this community. I also found a 2013 Matt Cutts video on the subject: https://searchenginewatch.com/sew/news/2298312/matt-cutts-you-dont-have-to-nofollow-internal-links At a couple of SEO conferences I’ve attended this year, I was advised that nofollow on internal links can be useful so as not to squander link juice on secondary (but necessary) pages. I suspect many websites have a lot of internal links in their footers and are sharing the love with pages which don’t really need to be boosted. These pages can still be indexed but not given a helping hand to rank by strong pages. This “equity sculpting” (I made that up) seems to make sense to me, but am I missing something? Examples of these secondary pages include login pages, site maps (human readable), policies – arguably even the general contact page. Thoughts? Regards,
Technical SEO | | Warren_Vick
Warren1 -
Schema markup for products is missing "price": Is this bad?
Hey guys, So a current client of mine has an e-commerce shop with a few hundred products. They purposely choose to keep the prices off of their website, which is causing errors in Google Webmaster Tools. Basically the error shows: Error: Structured Data > Product (markup: schema.org) Error type: missing price 208 items with error Is this a huge deal? Or are we allowed to have non-numerical prices for schema ie. "call for quote"
Technical SEO | | tbinga1 -
Rel="author" showing old image
I'm using http://www.google.com/webmasters/tools/richsnippets to test my rel="author" tag which was successful, but I noticed I wanted to change my image in Google+ as it is not what I want. I changed my image in Google+, it's been over 14 hours now and still not showing the new picture using the RichSnippets tool. I know Google can take a couple weeks at least to show changes in search results, but this RichSnippet tool I thought was immeidate. Am I missing something here or am I just impatient? I want my new photo to show.
Technical SEO | | Twinbytes0 -
With or without "/" at the end of domain
Hello, A client domains appear sometimes like www.domain.co.uk and sometimes like www.domain.co.uk/ I would like to place redirects from URLs that contain strings such as /index.aspx?id=42 to the main page but which one should I pick? With or without the "/" ? Thank you
Technical SEO | | DavidSpivac0 -
Will training videos available on the "members only" section of a site contribute to the sites ranking?
Hello, I got asked a question recently as to whether training videos on the deeper pages of a website (that you can only access if you are a member and log in) will help with the sites ranking. On the SEOMoz software these deeper pages have been crawled as far as I can tell with errors reported on pages from the "members only" section of the site, leading me to believe the members only pages and their content will contribute to the sites overall ranking profile. I have suggested uploading the informational videos on the main pages of the site for now, making them accessible to all visitors and putting them in a more obvious place to encourage more sharing and views, however I've also said I would check it out with some experts so any information will be greatly appreciated! Many thanks 🙂 Charlotte
Technical SEO | | CharlotteWaller0 -
Google +1 not recognizing rel-canonical
So I have a few pages with the same content just with a different URL. http://nadelectronics.com/products/made-for-ipod/VISO-1-iPod-Music-System http://nadelectronics.com/products/speakers/VISO-1-iPod-Music-System http://nadelectronics.com/products/digital-music/VISO-1-iPod-Music-System All pages rel-canonical to:
Technical SEO | | kevin4803
http://nadelectronics.com/products/made-for-ipod/VISO-1-iPod-Music-System My question is... why can't google + (or facebook and twitter for that matter) consolidate all these pages +1. So if the first two had 5 +1 and the rel-canonical page had 5 +1's. It would be nice for all pages to display 15 +1's not 5 on each. It's my understanding that Google +1 will gives the juice to the correct page. So why not display all the +1's at the same time. Hope that makes sense.0 -
Syndication: Link back vs. Rel Canonical
For content syndication, let's say I have the choice of (1) a link back or (2) a cross domain rel canonical to the original page, which one would you choose and why? (I'm trying to pick the best option to save dev time!) I'm also curious to know what would be the difference in SERPs between the link back & the canonical solution for the original publisher and for sydication partners? (I would prefer not having the syndication partners disappeared entirely from SERPs, I just want to make sure I'm first!) A side question: What's the difference in real life between the Google source attribution tag & the cross domain rel canonical tag? Thanks! PS: Don't know if it helps but note that we can syndicate 1 article to multiple syndication partners (It would't be impossible to see 1 article syndicated to 50 partners)
Technical SEO | | raywatson0