Bryan Soltis

Senior Software Engineer

Posted on October 11, 2008

BlogEngine.NET Positional Breadcrumbs

In developing the Bit-Wizards Blogs theme, I found that there was a lack of positional breadcrumbs in BlogEngine.NET.  I found many that were "Historical", or “Hierarchical", but these did not fit our needs.  So I created a simple user control that displays a link back to the blog home when a user views a post or sub page.


protected void Page_Load(object sender, EventArgs e)
{
//Make sure user is on a page that is not the home page
if (!(Request.Url.AbsoluteUri.ToLower()).EndsWith("default.aspx"))
{
if (Request.QueryString["id"] != null)
{
if (Request.QueryString["id"] != "")
{
//Determine the post the user is on
Guid id = new Guid(Request.QueryString["id"]);
Post post = Post.GetPost(id);
//Build the breadcrumb text
StringBuilder sb = new StringBuilder();
sb.Append(
"<div id=\"Breadcrumb\"><div id=\"Breadcrumbtext\">");
sb.Append(
"<a href=\"" + Request.ApplicationPath + "\">Blog Home</a> > ");
sb.Append(post.Title);
sb.Append(
"</div></div>");
litBreadcrumbs.Text = sb.ToString();
}
}
}
}

 

Comments
Blog post currently doesn't have any comments.

Want to join the conversation?  Leave a comment using the form below!



 Security code