Hiding Content From Site Search / Crawlers

Posted by Community Admin on 03-Aug-2018 21:14

Hiding Content From Site Search / Crawlers

All Replies

Posted by Community Admin on 10-May-2011 00:00

Hello,

We would like to exclude certain parts of our pages from being rendered when requested by the search indexer or other crawlers.

In v3.x, we were able to this:

protected override void Render(HtmlTextWriter writer)
    // Do not render this control for the index crawler
    // (we don't want the contents of this control to be indexed)
    if (!Telerik.CmsContext.IsCrawlerRequest)
    
        base.Render(writer);
    
 which would prevent a control's contents from rendering for the crawlers. How can we accomplish the same in 4.x?

Thank you!

Regards,
John G.

Posted by Community Admin on 12-May-2011 00:00

Hi John,

You can use the code below.

var page = GetPage(pageNode, provider, htmlWriter, out context);
if( page.Items["IsInIndexMode"])




All the best,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 12-May-2011 00:00

Hi Ivan,

The example code you posted does not work in the context of the "Render" method of a control (i.e. the example code I posted). I am not familiar with the "GetPage" method. I checked the PageManager object, but did not see it there either.

Could you provide some clarification on how to use the code you posted?

Thank you!

Regards,
John

Posted by Community Admin on 16-May-2011 00:00

Hi John,

The code works just fine, since we the same index key in our code base. GetPage is a method that returns System.Web.UI.Page. So if you have access to the System.Web.UI.Page object you call .Items[key]

Greetings,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 13-Feb-2012 00:00

I have been trying to do this same thing and I am not having any luck finding the GetPage method that is described as the answer to this problem.  Can anyone provide me with where this is located?  I am also trying to use this in a user control.

Posted by Community Admin on 14-Feb-2012 00:00

Hello,

You can use the standard ASP.NET Page and its Items property

msdn.microsoft.com/.../system.web.ui.page.items.aspx

Another option is to follow this blog post

www.sitefinity.com/.../hiding_page_content_from_the_search_engine_in_sitefinity_using_layout_widgets.aspx


Kind regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed