This project is read-only.

Hiding Pages from Search

Topics: Controls
Jul 15, 2010 at 11:49 AM
Hi all, We've been integrating the BlogEngine.NET app one of our e-commerce solutions and have had much success with it. However we are also using the 'pages' functionality to create the content that we need for the 'static' pages in our main site (such as About Us, Terms, etc). I would like to be able to restrict the search and related posts to only search through Blog Posts and to ignore an pages completely. I'm just wondering if there is a handy way to do this? I know that both the search and the related posts use the same Class to produce the results but is there a way to specifically get this to just search and return items that are only a blog post? Regards, G
Jul 15, 2010 at 1:14 PM

I think changing the code is the only option.  In the BE core, there's a Search.cs file.  The pages are being added with this code:

foreach (Page page in Page.Pages)
	if (page.IsVisibleToPublic)
You could comment out or remove that code.  Because this code is in the BE core, after making the change, you would need to recompile the BE core to produce a new BlogEngine.Core.dll file that will replace the existing DLL file in your BIN directory.

Jul 15, 2010 at 1:43 PM
Hi Ben, Thanks for the suggestion. I'll give that a try and see what happens. I'm not a .NET developer so my changing of code has been kept to the simplest of tasks. I'll let you know how I get on!