Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonathan Roberts 409 posts 1063 karma points
    Jan 22, 2018 @ 17:23
    Jonathan Roberts
    0

    RTE on CSHTML page has locallink:umb:// in the links

    Hi,

    I am using an RTE in the Grid in the latest version of umbraco CMS and when the page is published the links from the Text editor have links like:

    <a data-udi="umb://document/a8990cb2424346b9a12041a30e3ea541" href="/{localLink:umb://document/a8990cb2424346b9a12041a30e3ea541}" title="Home">And a super link</a>
    

    I am using @Html.Raw(rtesource) - do i need to do anything else?

    I have seen a few old links to possible fixes but none work now.

    Thanks

    Jon

  • Anders Bjerner 487 posts 2990 karma points MVP 8x admin c-trib
    Jan 22, 2018 @ 18:50
    Anders Bjerner
    1

    Hi Jonathan,

    It should work if you put the value through the ParseInternalLinks method:

    string html = Umbraco.Web.Templates.TemplateUtilities.ParseInternalLinks(rteGridValue, UmbracoContext.Current.UrlProvider);
    
    @Html.Raw(html)
    
  • Jonathan Roberts 409 posts 1063 karma points
    Jan 23, 2018 @ 08:25
    Jonathan Roberts
    0

    I have tried Umbraco.Web.Templates.TemplateUtilities.ParseInternalLinks but it says it cant find Web in Umbraco - what do I need to reference?

  • Anders Bjerner 487 posts 2990 karma points MVP 8x admin c-trib
    Jan 23, 2018 @ 08:32
    Anders Bjerner
    100

    It should work out of the box, as I've used the full path of the TemplateUtilities class. From what I can tell, the class is located in umbraco.dll.

    A cause for the error could be if you have a folder somewhere in your solution called Umbraco. In that case, you could try something like below instead (the difference being that the full class name is now prefixed with global::):

    string html = global::Umbraco.Web.Templates.TemplateUtilities.ParseInternalLinks(rteGridValue, UmbracoContext.Current.UrlProvider);
    
    @Html.Raw(html)
    
  • Christian A 24 posts 98 karma points c-trib
    Jan 06, 2021 @ 09:51
    Christian A
    0

    Just stumpled upon this, for future reference if people have the same reference issue, the reason is "Umbraco" is a reference for UmbracoHelper in most Umbraco Contexts, which results in the error Jonathan describes.

    Instead just reference Umbraco.Web.Templates and use "TemplateUtilities.ParseInternalLinks()" to invoke the method.

    @using Umbraco.Web.Templates
    
    string html = Templates.TemplateUtilities.ParseInternalLinks(rteGridValue, UmbracoContext.Current.UrlProvider);
    
    @Html.Raw(html)
    
  • Jonathan Roberts 409 posts 1063 karma points
    Jan 23, 2018 @ 09:09
    Jonathan Roberts
    0

    Hi,

    Thank you so much - this works like a charm.

    Thanks again for all your help,

    Jon

Please Sign in or register to post replies

Write your reply to:

Draft