BlogEngine.NET Disappearing Page Slug

by Steve Bumbaugh 11. December 2008 20:11

Problem Background

While working  on my blog at www.stevebumbaugh.com I have come across with the MySQL implementation of BlogEngine.NET.  It is possible to create a page and set a custom slug that is different than the title.  When working on a post with a custom slug everything seems to work as expected.  Unfortuantely when I would come back to the page at a later time, the custom URL would change, resulting in a 404, page not found error.  Editing the page would reveal that the custom slug had reverted back to the default slug for the page.

Slugs

In BlogEngine.NET the slug can be used to define the page name.  For instance, when viewing this post, the slug is blogenginenet-disappearing-page-slug.  This allows the administrator to control page names for posts and custom pages.  This can also help with search engine optimization.  Unfortunately this functionality is not implemented for custom pages (it does not affect posts) created when using a database implementation instead of XML implementation of BlogEngine.NET.

The database table be_Pages does not contain a field for slugs as would be expected.  A look at the source code also confirms this, the database provider implementation BlogEngine.Core.Providers.DbBlogProvider.InsertPage(Page page) ignores the Slug property of the Page object.  In contrast, XML provider BlogEngine.Core.Providers.XmlBlogProvider.InsertPage(Page page), does appear to save the slug; although, I have not tested this functionality.

Conclusion

There is currently not a way to set custom page slugs in BlogEngine.NET when using MySQL.  When the custom slug is saved it seems to be cached in memory.  Once that cache expires the custom slug is lost because it has no way to be persisted to the database.  This is not really a big deal for me because I did not need a custom page name, but it did cause some confusion.  Updating the code to store the slug doesn't seem like it would take too much effort if there really was a need to do so.

Environment

 

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , ,

Categories: General | Web Development | Configuration


Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



©2010 www.codecarnage.com


RecentComments

Comment RSS