Hijack rendering of the Umbraco rich text editor


While building a clients site not so long ago we came across an interesting problem with the Umbraco text editor. Our client had a complex URL requirement so we used the umbracoUrlAlias field to generate out own rather than using the default Umbraco URL.


However when links added in the tinymce text editor were rendered on the front end we found there wasn't an robust way to tell Umbraco to use the alternate URL and not the default one. We had to get creative.


We ended up creating a html helper which used a modified version of Umbraco's own link parsing method to parse a string which contains Umbraco udis: https://github.com/umbraco/Umbraco-CMS/blob/cf86409e3fec4198744189a48255543fc2f32614/src/Umbraco.Web/Templates/TemplateUtilities.cs


We altered the method to pull out our url on lines 64 and 71, now if we just left it at that we would have still had a problem as when we pulled the data out of our models in the view the property converters would have used Umbracos link parser. For this reason when we pulled the property out we had to use its raw data value and pass it to our parser: Model.GetProperty("alias").DataValue


Hopefully if you're having the same problem we have given you a place to start building a solution! One thing you will need to watch out for is changes in the Umbraco method in future as this may break your copy if things change.


Drop us a line if you need any further info, advice or support from our expert Umbraco certified developers

Get in touch


See how we can improve your online presence.


Start your next project