Hiding Content From Site Search / Crawlers
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);
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
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
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
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.
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