One of the most common challenges search engines run into when indexing a website is identifying and consolidating duplicate pages. Duplicates can occur when any given webpage has multiple URLs that point to it. For example:
| URL | Description |
| http://mysite.com | A webmaster may consider this their authoritative or canonical URL for their homepage. |
| http://www.mysite.com | However, you can add ‘www’ to most websites and still get the same home page. |
| http://mysite.com/default.aspx | You can also often add the specific filename of the homepage and get the same page |
| http://mysite.com/default.aspx?promo=ABC | Many times websites use parameters to track things like where customers are coming from (in this case an offline promotion), or parameters that determine how the content on the page is formatted. |
These four cases are just a few of the many possibilities. When you consider all the combinations of these, you could have more than 10 clone URLs for every page on your site. That means if there are 1 million pages on your site, we could possibly find 10 million or more cloned URLs pointing to them. Determining your canonical URL amongst all the duplicate clutter has been an onerous challenge for search engines as we all work to reduce cost and improve relevance.
To help solve this issue, a new tag attribute that will help webmasters identify the single authoritative (or canonical) URL for a given page. The link tag defines a relationship between a document and an external resource. In this case, that resource is the canonical URL. The following is an example of the new link tag attribute for canonicalization:
<link rel="canonical" href="http://mysite.com"/>
now, the search engine will suddenly count the links it has seen to that campaign tagged URL, towards the canonical URL, and not index the campaign tagged URL anymore. Simple, yet effective. This feature works with Google, and both Live Search and Yahoo!.
The “canonical” feature represents a timely, relevant, and positive partnership between major search engines. It is a step to ensuring more consistency with regard to treatment of duplicates among all of the engines. It will also put more control into the hands of site designers over how their sites are represented within the search indexes.
1) This tag is a suggestion to search engines and is not guaranteed to be used. 301 redirects and good link strategy is still important
2) You can not use this tag to redirect between domains. We can’t redirect Domain1.com to Domain2.com using this tag
3) You CAN suggest SSL urls as the preferred format. https://www.domain.com
4) Don’t abuse the tag to redirect users to non-similar content. The search engines are smarter than that now.
5) Try and use absolute URLs instead of relative ones. Point directly to the final destination because a chain of canonical links may not be followed.
Is rel="canonical" a hint or a directive?
It’s a hint that we honor strongly. We’ll take your preference into account, in conjunction with other signals, when calculating the most relevant page to display in search results.
Can I use a relative path to specify the canonical, such as <link rel="canonical" href="product.php?item=swedish-fish" />?
Yes, relative paths are recognized as expected with the <link> tag. Also, if you include a <base> link in your document, relative paths will resolve according to the base URL.
Is it okay if the canonical is not an exact duplicate of the content?
We allow slight differences, e.g., in the sort order of a table of products. We also recognize that we may crawl the canonical and the duplicate pages at different points in time, so we may occasionally see different versions of your content. All of that is okay with us.
What if the rel="canonical" returns a 404?
We’ll continue to index your content and use a heuristic to find a canonical, but we recommend that you specify existent URLs as canonicals.
What if the rel="canonical" hasn't yet been indexed?
Like all public content on the web, we strive to discover and crawl a designated canonical URL quickly. As soon as we index it, we’ll immediately reconsider the rel=”canonical” hint.
Can rel="canonical" be a redirect?
Yes, you can specify a URL that redirects as a canonical URL. Google will then process the redirect as usual and try to index it.
What if I have contradictory rel="canonical" designations?
Our algorithm is lenient: We can follow canonical chains, but we strongly recommend that you update links to point to a single canonical page to ensure optimal canonicalization results.
Can this link tag be used to suggest a canonical URL on a completely different domain?
No. To migrate to a completely different domain, permanent (301) redirects are more appropriate. Google currently will take canonicalization suggestions into account across subdomains (or within a domain), but not across domains.
Here is the way we can add item level permission for a user on an item,
SPRoleDefinition oUserRole;
SPRoleAssignment oUserRoleAssignment;
SPListItem itm;
SPSite site = null;
SPWeb web = null;
string siteUrl = Request.Url.ToString();
site = new SPSite(siteUrl);
web = site.OpenWeb();
SPGroup grp = web.Groups[groupname];
itm=web.Lists["Shared Documents"].Items[0];
oUserRole = web.RoleDefinitions.GetByType(SPRoleType.Administrator);
oUserRoleAssignment = new SPRoleAssignment(loginName, emailId, userDisplayName, notes);//for user
or
oUserRoleAssignment = new SPRoleAssignment(grp);//for group
oUserRoleAssignment.RoleDefinitionBindings.Add(oUserRole);
itm.RoleAssignments.Add(oUserRoleAssignment);
web.AllowUnsafeUpdates = true;
itm.Update();
web.Update();
web.AllowUnsafeUpdates = false;
This is useful for setting item level permission via code.
tags: .Net, ASP.Net, Permissions, Sharepoint, Sharepoint PermissionToday I went through one of the video that showed how to work with LINQ and while going through I saw something which I had seen many a times before but everytime I forget about that, but this time I remembered.
What I saw was the person who showed a small demo on the LINQ started to write something, in the class he wrote some 2-3 words and the code for the class appeared automatically. I used to wonder on how they do that so I thought let me check on that, you just write couple of words and you have your class ready with you. After doing some research on that here is what I have.
This is a small Add-on for Visual Studio called as AutoCode which helps you to create a shortcut for a piece of code which you use regularly. What it does is helps you to create a template for the most used code and set a shortcut for that, the next time you want to use that piece of code you need not write that code again all you have to do is type the shortcut you have set for the code that that code will be there. Amazing!!!!!!
You can download the Add-on from here. Also check out the quickstart that will help you to learn how you can start using the AutoCode Add-on.
So start using the AutoCode and save your time by saving the repetative code to be used by just a shortcut.