RelativeOrAbsoluteLink failing

Topics: Business Logic Layer, Themes
Nov 9, 2012 at 12:01 AM
Edited Nov 9, 2012 at 12:05 AM

Having an issue with the Sub Blog and using "RelativeOrAbsoluteLink" to link the title from the parent blog to the sub blog entry.

This is what seems to be happening

Primary Blog is setup with "Is For Site Aggregation"

Sub Blog is created with a Virtual Path set to ~/TestBlog

Now i see both entries on the Primary Blog, but the title link is failing to point to the sub blog.

It goes to 

http://localhost:21252/BlogEngine27/post/Welcome-to-BlogEngineNET-27.aspx

rather then

http://localhost:21252/BlogEngine27/TestBlog/post/Welcome-to-BlogEngineNET-27.aspx

Code in PostView.ascx is

 

<h1><a href="<%=Post.RelativeOrAbsoluteLink %>" class="taggedlink"><%=Server.HtmlEncode(Post.Title) %></a></h1>

Twist

Now the twist is that if i enable the "Add date to post links" is the sub blog, everything works fine - without it the link in the title fails to point to the sub blog post

http://localhost:21252/BlogEngine27/TestBlog/post/2012/10/15/Welcome-to-BlogEngineNET-27.aspx

Nov 9, 2012 at 5:29 PM

Just to add, I tested this both on a 2.6 version as well as out of the box 2.7 release and both yielded the same results.  If anyone has any suggestions where to start looking, I would greatly appreciate it.  Holding up the launch of a site due to this :(

Coordinator
Nov 9, 2012 at 10:25 PM

I would need to take closer look, but you can start by modifying code in BlogEngine.Core/Post.cs.

This is Core library and you would have to get source code and build new BlogEngine.Core.dll, unfortunately.

The code in getter for "public string RelativeLink"

Change from:
: string.Format("{0}post/{1}", Utils.RelativeWebRoot, theslug);

Change to:
: string.Format("{0}post/{1}", this.Blog.RelativeWebRoot, theslug);

Seems to work fine, but need more testing to make sure nothing else effected.

Coordinator
Nov 10, 2012 at 9:27 PM

Looks like you're right Ruslan.  this.Blog.RelativeWebRoot is in there correctly when settings.TimeStampPostLinks is true, but if there are no timestamps, Utils.RelativeWebRoot is incorrectly being used.  Argh!

Nov 12, 2012 at 9:55 PM

I'll fix this on my end, is this something that should be reported somewhere else to address with the next release?