I recently changed the layout of some of my categories in BlogEngine.Net 1.4.5.0. In short I wanted to add a few parent Categories for the categories that I was already using. For example: I have a category name ".net" that I lump all of my .net related items in but what if I also have some java code or C++ code and I have a category for them as well? To me it makes sense to have a parent category called "development" and then if I want to view all code or development related items including C#, VB, Java, HTML, C/C++ then all I have to do is click on the new parent category and voila you have everything development related no matter what the sub-category is.
So for the bug:
When the Category List control/widget is rendered it looks at the Category.FullTitle to build the URI. This works fine if you are not a sub-category, like ".net" using the example above, but when rendering the URI for these sub-categories its using the FullTitle which is a concatenation of the parents categories and the title of the sub-category: ie: "development - .net". This does not work and that link should really just be to the ".net" category. So here is the simple code fix that I used, but take in mind that you could also make it so that "development - .net" works. I just found a quick and easy fix...
Code fix after the break.
The code change needs to take place in the app_code/controls/categorylist.cs file on line ~130.
Original code: 1: HtmlAnchor anc = new HtmlAnchor();
2: anc.HRef = Utils.RelativeWebRoot + "category/" + Utils.RemoveIllegalCharacters(key) + BlogSettings.Instance.FileExtension;
3: anc.InnerHtml = HttpUtility.HtmlEncode(key) + postCount;
4: anc.Title = "Category: " + key;
5:
6: li.Controls.Add(anc);
7: ul.Controls.Add(li);
Fixed Code: 1: HtmlAnchor anc = new HtmlAnchor();
2: Category category = Category.GetCategory(dic[key]);
3:
4: anc.HRef = Utils.RelativeWebRoot + "category/" + Utils.RemoveIllegalCharacters(category.Title) + BlogSettings.Instance.FileExtension;
5: anc.InnerHtml = HttpUtility.HtmlEncode(key) + postCount;
6: anc.Title = "Category: " + key;
7:
8: li.Controls.Add(anc);
9: ul.Controls.Add(li);