Kentico MVC Quick Tip - Fix Broken Insert Link Button

Last week, a developer that I work with here at BizStream came to me seeking some quick help on one of our Kentico MVC projects. When he showed me the issue, I was initially quite surprised because the thing that wasn't working, was inside of the Kentico admin interface. It had nothing to do with our custom code on the live site. The issue existed when editing content with WYSIWYG content fields, something that has always "just" worked in Kentico since the very first version. Specifically, the problem boiled down to creating links inside of the content field that targeted internal site pages using the Insert link button's dialog picker. 

The expected behavior of the Insert link button dialog would be to allow a content admin to navigate the Kentico content tree, find an internal page that the link should target, and with a simple click of the Save & Close button the CMS will generate a correct relative URL to the that page of the tree. Dead simple right?

Well in this case, no matter what page we chose in the picker on our Kentico MVC the dialog always generated the link with an href that was "~/" instead of the correct URL path to the content page. Crazy right?

Keep reading after the jump to see what was causing the issue and how to resolve it.

 

Read more »