BE.NET 2.6 Archive Category Links with Multi-Blogs

Jun 13, 2012 at 8:57 PM

While kicking the tires of v2.6 I noticed that the Achive Page Category Anchor Links don't work correctly with multiple blogs.

Url created is always http://site/blogroot/#category-name

I made the following change

// Sueetie Modified 
if (SiteSettings.Instance.MultiBlogConfiguration)
    a.HRef = string.Format("{0}archive.aspx#{1}", Utils.RelativeWebRoot, Utils.RemoveIllegalCharacters(title));
else
    a.HRef = "#" + Utils.RemoveIllegalCharacters(title);
a.Attributes.Add("rel", "directory");

That ensures Url of http://site/blogroot/virtualpath/archive.aspx#category-name

As a sidebar, I'm using a Framework property to test for multi-blog configuration.  Is there a BlogEngine.NET-specific method/property to determine if using multiple blogs?  Just curious.

Thanks,
Dave

 

Coordinator
Jun 14, 2012 at 3:37 AM

You right, missed that. We usually use Blog.CurrentInstance to check for thing like "Blog.CurrentInstance.IsPrimary" etc. So in this case code below should work for both parent and child blogs:

a.HRef = string.Format("{0}#{1}", Blog.CurrentInstance.RelativeWebRoot, Utils.RemoveIllegalCharacters(title));

Jun 14, 2012 at 1:04 PM

Rtur,

"Blog.CurrentInstance."  I'll definitely remember that.  Thanks.  And yes, much nicer code with Blog.CurrentInstance.

-Dave