The last couple of days I’ve been working on improving the in-site search on this website. The old search was quite good, but it returned a list of full posts as a search result. It was difficult to get a good and quick overview of the results that way. When you included comments in the search it didn’t display the comments so you didn’t know whether or not the result was from a post or a comment. Last but not least, it didn’t search in pages. It wasn’t that big an issue for me because I only have one page, but in the future I plan to add more.
Enter the new search
I tried to keep as close to the major search engines' way of displaying results, but added some information relevant for blogs such as tags and categories. Try a search for code or Mads.
As you’ll see from the search results it displays posts, pages and comments in the same result page. It also tells you the type of each result so you can decide whether or not it is relevant to you.
Comment search
It has been possible to include comments in search results ever since BlogEngine.NET 1.0, but with this new search it gets more transparent. You can for instance search for your own name to see all the comments you’ve written yourself. That way I can see that Phil Haack has commented 6 times on my blog and Scott Hanselman has written one comment.
This new search feature will of course be included in the upcoming version of BlogEngine.NET due in a few weeks.
In the upcoming version of BlogEngine.NET it is now possible to embed standard ASP.NET user controls into the body of a post. We did this because a lot of people have built various user controls over time and it would be a shame not to be able to use them on a blog. This allows developers to put polls, forms and other cool stuff inside a blog post just by creating an .ascx user control.
The injection
Now, let’s say you have a user control called poll.ascx and want to inject it in the middle of the text of a blog post. The poll.ascx file is located in your theme folder, but could be located anywhere. To inject it you just type the following into the editor:
When the post is served it looks for any references to user controls, like the one above, and renders them inside the post. The only limitation is that postbacks will screw up the comment form. Therefore it is suggested that you use AJAX in the form of client-callbacks instead of postbacks. It doesn’t make sense to use postbacks anyway, because that would scroll the page to the top and that is very bad usability.
By injecting user controls in a post you can also place Google ads where ever you want. Just stick your Google JavaScript code in a user control and reference it. This can also be done using the extension model, but might be easier to modify.
I’m very excited about this feature because I can’t imagine all the possibilities it provides to BlogEngine users and what cool controls will be created. The 1.2 version is being released later this September.
Use custom web pages
If you want to create a custom web page instead of injecting user controls, you can still do that the same way as usual. Just place your custom .aspx page in the root and make it inherit from BlogEngine.Core.Web.Control.BlogBasePage instead of System.Web.UI.Page. When doing that it automatically loads your theme and master page around the page. You can then keep the look and feel of your theme, but totally control the content and functionality of your custom page.