Site structure
Version 3.x > Site structure > CMS Sitemap View modes: 
User avatar
Member
Member
tmcmahan - 10/3/2008 6:46:23 PM
   
CMS Sitemap
Is there a way to force the CMSSitemap control to render absolute paths instead of relative?

I want <a href="/Services.aspx"> to render as <a href="http://www.mysite.com/Services.aspx">.

Any help would be greatly appreciated, Thanks!

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 10/6/2008 10:12:31 AM
   
RE:CMS Sitemap
Hello,

I'm sorry, but it's not possible to do this now in some nice way. You may need to use a workaround for it and achieve your goal programmatically.

You will take 'RenderedHTML' property, go through it and find and change all links using 'UrlHelper.MakeLinksAbsolute' function. This will enforce that your links in site map will use absolute path.

I hope it's clear, if not, don't hesitate to ask.

Best regards
Ondrej Vasil

User avatar
Member
Member
tmcmahan - 10/8/2008 12:55:53 PM
   
RE:CMS Sitemap
Thanks for your response Ondrej!

I have successfully parsed the RenderedHTML property and updated the URLs but I am having trouble forcing the control to render the updated string.

I tried assigning my updated string to the RenderedHTML prop but I believe this is happening too late in the life cycle to affect the control's output:

this.smElem.RenderedHTML = MyHelper.RewriteSiteMapHTML(this.smElem.RenderedHTML);


How do I force the CMSSitemap control to output my new RenderedHTML string?

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 10/10/2008 5:14:52 AM
   
RE:CMS Sitemap
Hello,

it's probably because the page is loaded again just after you set absolute addresses. So it changes them back to relative.

Could you please try add following code?

this.smElem.LoadDataAutomaticaly = false;

Best regards
Ondrej Vasil

User avatar
Member
Member
tmcmahan - 10/10/2008 11:17:44 AM
   
RE:CMS Sitemap
Hi Ondrej,

That property was the missing piece! The sitemap control now renders my updated string.

Thanks a million!