Thursday, October 31, 2013

Partial Page Exclusion in SharePoint Search

Background:

Out of the box search results in SharePoint shows unnecessary data such as navigation, left nav, footer, right nav etc., that may not be useful to end user. Fortunately, it’s easy to exclude those items from appearing in search results by using a technique called “Partial Page Exclusion”.

How to use:

Just include a class called “noindex” for the items that needs to be excluded from search results. This tells the crawler to ignore those items. Here is a sample example in which crawler is forced to crawl only content present in body class. All other items are ignored.

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div class="wrapper">
<div class="header noindex">
// Header Data
</div>
<div class="topnav noindex">
// Navigation
</div>
<div class="body">
// Header Data
</div>
<div class="footer noindex">
// Footer Data
</div>
</div>
</body>

</html>

No comments:

Post a Comment