Out of the box, SharePoint provides a mechanism for excluding publishing pages from the search index by any number of criteria, but what if you want to exclude only parts of a page? This becomes useful when you have content on numerous pages that contains common keywords.
For Example, In Our Production site we have master page and in this master page , Header , Left Navigation and footer for the Pages.
So when someone performs a search for "Careers" they will get back every page in your site, instead of just the Careers and related Careers pages. To prevent this, we needed a way to keep SharePoint from indexing that content when it's performing a crawl.
We decided that a System.Web.UI.WebControls.Panel control would be a good model to build my control on. It allows you to easily drop it in the page layout using SharePoint Designer, and you can put other html and controls within it. I didn't want to inherit from the Panel control though, because it adds unwanted 'div' tags to the rendered output. The key to the Panel control's behavior are the following two attributes on the class:
These attributes allow the content within the control to persist as controls and not properties of this control.
The second part of the equation is knowing when to show or hide the contents of the web control.
SharePoint gives us a way to identify that it's performing a crawl through the UserAgent property of the http request by adding "MS Search" to it.
Putting this all together we come up with the following class:
public class SearchCrawlExclusionControl : WebControl
private string userAgentToExclude;
public string UserAgentToExclude
return (string.IsNullOrEmpty(userAgentToExclude)) ? "ms search" : userAgentToExclude;
userAgentToExclude = value;
protected override void CreateChildControls()
string userAgent = this.Context.Request.UserAgent;
this.Visible = (!string.IsNullOrEmpty(userAgent)) ? !userAgent.ToLower().Contains(UserAgentToExclude) : true;
Register Web Control within Page.
<%@ Register Tagprefix="SearchUtil" Namespace="ABC.SharePoint.WebControls" Assembly="ABC.SharePoint, Version=18.104.22.168, Culture=neutral, PublicKeyToken=xxxxxx" %>
After adding the register tag to the page layout, we can wrap all the content we want to exclude with our control:
span>SearchUtil:SearchCrawlExclusionControl ID="SearchCrawlExclusionControl1" runat="server">
span>div>Some Content To Excludediv>
After applying this User control to all your excluding Div and HTML tags.
Make Incremental or Full crawl of you web site.
How to edit the User Agent string in Mozilla FireFox
To change the User Agent string, just enter about:config as an address in the address bar of FireFox, the location where you normally enter a URL (link). I recommend to preserve the original value, which you can get when you enter just about: in the address bar.
Now press the right mouse button to get the context menu and select "String" from the menu entry "New". Enter the preference name "general.useragent.override", without the quotes. Next, enter the new User Agent value you want Mozilla Firefox to use.
I added my name and a link to my web site to the original value. You can also pick one from the list of User Agent strings. Check the new value by entering about: in the address bar.
How to edit the User Agent string in Google Chrome
Here's how to change the user agent:
To get more information about sharepoint consulting visit http://www.binaryrepublik.com/