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
-
Yeah, wish I could give you a simpler answer, but I'm afraid it might end up being a little tricky. Hit the biggest problems first, and at least you can manage time/money a bit. The one bright side is that the rules should be no harder to code in ColdFusion than anything else (PHP, ASP, whatever). It's just the core logic that's tricky.
-
That's what I thought. I need to find someone in the company who knows cold fusion and go through it.
Thanks for your help though. I appreciate it.
Farris
-
Unfortunately, the rules may differ from page to page and will be entirely dependent on how your pages are generated. If it's just a matter of the "index.cfm" version vs. root ("/") versions of pages, those canonical should be straightforward. For the other parameters, though (like "i", "fs", etc.), it depends entirely on the function of those parameters.
I know ColdFusion reasonably well, and even given that, I couldn't give you a one-size-fits-all rule that would solve the problem. It really has to be guided by your site structure and code/data logic. Personally, I'd start with the pattern that generates the most problems and solve that one first. In other words, if one template (like "/press-releases") generates dozens or hundreds of duplicates, deal with that first. If you solve the top 3-4 problems, you may clean up quite a bit. That could be more effective than trying to fix everything at once.
-
Here's a spreadsheet sample. I did what Roberto suggested. I have a column with the ready for every duplicate content URL.
The site is dynamic. That was the main problem I was facing, I'm not sure how to set the canonicals on each page without having to go into the html and copy the tag from the spreadsheet to the manually.
I added the screenshot of builtwith.com in the main question hoping it would give anyone insight as to how I would code rules to set the canonicals.
-
Could you provide an approximate example that matches your real situation (a fake domain is fine, but with the same basic format)? This is a situation where fake examples that don't match the real situation probably won't help us (or you) much.
Once you have the spreadsheet, how are you going to translate that into tags? If this is a dynamic site, it would be better to be able to code rules to set the canonicals - and potentially much easier.
-
Following the same concept:
- Create a column (Column E) with the following information "then another column (Column F) with ""/>"
- In column G enter the following formula: =CONCATENATE(E1,Cell of Duplicate URL, F3).
The end result will have Column A with the Domain in it. Follow steps 6 & 7 to complete the process.
Feel free to send me a sample spreadsheet with some info and I can set it up for you.
-
Roberto, Thank you for your answer. I just realized that I was unclear when I asked the question. I already have the link containing the canonical tag for each of the URLs ready. That is what column A already contains. I need to add that into the section of the pages in column 2,3, and 4. I'm just unsure how to do this for 1800 rows each containing the correct URL in column A, and in column 2,3, and 4 the URLs of the duplicate content pages that need the link added to the section. Check the image below to see what I mean. I appreciate the effort though Farris
-
Farris,
This is the way I would do it.
You have the following columns created:
- Column A: "canonical" tag for UR
- Column B: Duplicate Content URL # 1
- Column Duplicate Content URL # 2
- Column Duplicate Content URL # 1
Follow the next steps:
- Create three more columns with to duplicate columns B, C, D
- Use the following formula on column B "**=CONCATENATE(A1,B1)" **
- Copy the same formula for columns C & D
- Replace the “B1” in your formula for the respective columns (i.e. Column C should have C1.)
- Copy & Paste the content of columns E, F, G (The copied columns with formulas) to all the rows.
- Once copied, the information in columns E, F, G should look like the end result that you want.
- if data is correct, copy columns E, F, G and paste in the same location but use Paste Special and paste values only. This will remove your formulas.
I 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
-
[Organization schema] Which Facebook page should be put in "sameAs" if our organization has separate Facebook pages for different countries?
We operate in several countries and have this kind of domain structure:
Technical SEO | | Telsenome
example.com/us
example.com/gb
example.com/au For our schemas we've planned to add an Organization schema on our top domain, and let all pages point to it. This introduces a problem and that is that we have a separate Facebook page for every country. Should we put one Facebook page in the "sameAs" array? Or all of our Facebook pages? Or should we skip it altogether? Only one Facebook page:
{
"@type": "Organization",
"@id": "https://example.com/org/#organization",
"name": "Org name",
"url": "https://example.com/org/",
"sameAs": [
"https://www.linkedin.com/company/xxx",
"https://www.facebook.com/xxx_us"
], All Facebook pages:
{
"@type": "Organization",
"@id": "https://example.com/org/#organization",
"name": "Org name",
"url": "https://example.com/org/",
"sameAs": [
"https://www.linkedin.com/company/xxx",
"https://www.facebook.com/xxx_us"
"https://www.facebook.com/xxx_gb"
"https://www.facebook.com/xxx_au"
], Bonus question: This reasoning springs from the thought that we only should have one Organization schema? Or can we have a multiple sub organizations?0 -
Please let me know if I am in a right direction with fixing rel="canonical" issue?
While doing my website crawl, I keep getting the message that I have tons of duplicated pages.
Technical SEO | | kirupa
http://example.com/index.php and http://www.example.com/index.php are considered to be the duplicates. As I figured out this one: http://example.com/index.php is a canonical page, and I should point out this one: http://www.example.com/index.php to it. Could you please let me know if I will do a right thing if I put this piece of code into my index.php file?
? Or I should use this one:0 -
Using rel=canonical
I have a set of static pages which were created with the purpose of targeting long tail keywords. That has resulted in Domain Authority dilution to some extent. I am now in the process of creating one page which will serve the same results but only after user selects the fields in the drop-down. I am planning to use rel=cannonical on the multiple pages pointing back to the new page. Will it serve the purpose?
Technical SEO | | glitterbug0 -
Why put rel=canonical to the same url ?
Hi all. I've heard that it's good to put the link rel canonical in your header even when there is no other important or prefered version of that url. If you take a look at moz.com and see the code, you'll see that they put the <link rel="<a class="attribute-value">canonical</a>" href="http://moz.com" /> ... pointing at the same url ! But if you go to http://moz.com/products/pricing for example, they have no canonical there ! WHY ? Thanks in advance !
Technical SEO | | Tintanus0 -
Home page indexed but not ranking...interior pages with thin content outrank home page??
I have a Joomla site with a home page that I can't get to rank for anything beyond the company name @ Google - the site works fine @ Bing and Yahoo. The interior pages will rank all day long but the home page never shows up in the results. I have checked the page code out in every tool that I know about and have had no luck....by all account it should be good to go...any thoughts/comments/help would be greatly appreciated. The site is http://www.selectivedesigns.com Thanks! Greg
Technical SEO | | DougHosmer0 -
Am I Doing this Canonical Right?
Hi,I admit to new to the Mod Rewrite.Here is my mod rewrite in my .htaccess# Begin non-www page protection # <ifmodule mod_rewrite.c="">RewriteEngine On
Technical SEO | | Force7
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]</ifmodule> # End non-www page protection #If I have my home page set toI really want the canonical to be www.domain.com no trailing slashDid I create a confllict, and if so, how should I change it?0 -
Rel=cannonical vs. noindex.follow for paginated pages
I"m working on a real estate site that has multiple listing pages, e.g. http://www.hhcrealestate.com/manhattan-beach-mls-real-estate-listings I'm trying to get the main result page to rank for that particular geo-keyword, i.e. "manhattan beach homes for sale". I want to make sure all of the individual listings on the paginated pages, 2,3, 4 etc. still get indexed. Is it better to add to all of the paginated pages, i.e.manhattan-beach-mls-real-estate-listings-2, manhattan-beach-mls-real-estate-listings--3, manhattan-beach-mls-real-estate-listings-4, etc. or is it better to add noindex,follow to those pages?
Technical SEO | | fthead91 -
On-Page Question
Im trying to increase value to specific pages by putting history, and additional images. Will copying snippets from other sites negatively affect me? Should the content be re-written completely?
Technical SEO | | Anest0