This is a migrated thread and some comments may be shown as answers.

Exclude RADmenu nav from SharePoint Search

5 Answers 64 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
Chuck
Top achievements
Rank 1
Chuck asked on 21 May 2012, 08:23 PM
We have found that the items list in our RADmenu top navigation for SharePoint 2010 are being indexed on every page by the SharePoint search. This makes it difficult to find a meaningful search result as many terms show up on every page in our site.
We have found an article on this topic

http://www.matdesmarais.com/2011/12/sharepoint-2010-excluding-navigation-nodes-from-search-crawl/  , which refers to including NOINDEX in the navigation items.

Is there a way to set our master page using RADmenu to insert the NOINDEX in all of the DIVs associate with the menu navigation?


5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 22 May 2012, 09:59 AM
Hi Chuck,

You can set the CssClass property for the menu and for the items:
<telerik:RadMenu ID="RadMenu1" runat="server" CssClass="noindex"
       onitemdatabound="RadMenu1_ItemDataBound">
       <Items>
           <telerik:RadMenuItem runat="server" Text="Root RadMenuItem1">
               <Items>
                   <telerik:RadMenuItem runat="server" Text="this" CssClass="noindex">
                   </telerik:RadMenuItem>
                   <telerik:RadMenuItem runat="server" Text="Child RadMenuItem 2">
                   </telerik:RadMenuItem>
                   <telerik:RadMenuItem runat="server" Text="Child RadMenuItem 3">
                   </telerik:RadMenuItem>
               </Items>
           </telerik:RadMenuItem>
           <telerik:RadMenuItem runat="server" Text="Root RadMenuItem2">
           </telerik:RadMenuItem>
           <telerik:RadMenuItem runat="server" Text="Root RadMenuItem3">
           </telerik:RadMenuItem>
       </Items>
   </telerik:RadMenu>

If the menu is databound, then you can use ItemDataBound:
protected void RadMenu1_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e)
   {
       e.Item.CssClass = "noindex";
   }


Kind regards,
Peter
the Telerik team
Learn how the Telerik controls can be integrated in SharePoint 2007/2010 from this resource. To watch them in action, explore our online SharePoint 2010 demo site.
0
Chuck
Top achievements
Rank 1
answered on 26 May 2012, 12:53 AM
is there a similar approach that would allow us to set the noindex on the section
<div class="rmSlide">

so that the end result was <div class="rmSlide noindex">

0
Peter
Telerik team
answered on 30 May 2012, 11:38 AM
Hi,

You can use jQuery to add the 'noindex' class to any elements you need to. For example:
<script type="text/javascript">
       function OnClientLoad(sender) {
 
           var $ = $telerik.$;
 
           $(sender.get_element()).addClass("noindex");
           $(".rmSlide").addClass("noindex");
           $(".rmText").addClass("noindex");
           $(".RadSiteMap").addClass("noindex");
 
       }
   </script>
   <telerik:RadMenu ID="RadMenu1" Skin="Sitefinity" runat="server" OnDataBound="RadMenu1_DataBound"
       OnClientLoad="OnClientLoad">
   </telerik:RadMenu>


All the best,
Peter
the Telerik team
Learn how the Telerik controls can be integrated in SharePoint 2007/2010 from this resource. To watch them in action, explore our online SharePoint 2010 demo site.
0
Chuck
Top achievements
Rank 1
answered on 30 May 2012, 03:29 PM
Thanks for the suggestion, but the Microsoft search engine will not process the jQuery script and so will not see the noindex class. Our goal is to exclude the global naviagation DIVS from the SharePoint search and to do so requires inserting the noindex class  on each DIV and every DIV to be exclude before if it is sent to the client.
0
Peter
Telerik team
answered on 05 Jun 2012, 05:21 AM
Hello Chuck,

In that case, you will have to override the rendering of the controls involved in your navigation system. . For example, for RadMenu you can do the following:
public class CustomRadMenu: RadMenu
{
    protected override string CssClassFormatString
    {
        get
        {
            string formatString = "RadMenu RadMenu_{0} noindex";
 
            if (Attributes["dir"] == "rtl")
            {
                formatString += " RadMenu_rtl RadMenu_{0}_rtl noindex";
            }
 
            if (!Width.IsEmpty || !Height.IsEmpty)
            {
                formatString += " rmSized";
            }
 
            return formatString;
        }
    }
}

protected void Page_Load(object sender, EventArgs e)
   {
       CustomRadMenu myMenu = new CustomRadMenu();
       RadMenuItem rootItem = new RadMenuItem("root 1");
       rootItem.Items.Add(new RadMenuItem("child 1"));
       myMenu.Items.Add(rootItem);
       Page.Form.Controls.Add(myMenu);
   }


Kind regards,
Peter
the Telerik team
Learn how the Telerik controls can be integrated in SharePoint 2007/2010 from this resource. To watch them in action, explore our online SharePoint 2010 demo site.
Tags
Sharepoint Integration
Asked by
Chuck
Top achievements
Rank 1
Answers by
Peter
Telerik team
Chuck
Top achievements
Rank 1
Share this question
or