Copied to clipboard

Flag this post as spam?

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


  • Dan Lister 416 posts 1974 karma points c-trib
    Dec 29, 2012 @ 13:04
    Dan Lister
    0

    uSiteBuilder and RTE local links not rendering correctly

    So I have a document type class with a Rich Text Editor content property as follows:

    [DocumentTypeProperty(UmbracoPropertyType.RichtextEditor]
    public string ContentBody
    {
    get;
    set;
    }

    From Umbraco, editors may add links to local Umbraco pages. Using Razor, I'm trying to render the Content Body property as HTML with local links parsed to their corresponding friendly urls. If I wasn't using uSiteBuilder, I could just use the Umbraco.Field() method and the output would be correct. When using uSiteBuilder, the following would be render for local links:

    <a href="/{localLink:1075}">Link Text</a>

    Is there anyway to parse the property and turn local link references into nice urls?

  • Dan Lister 416 posts 1974 karma points c-trib
    Dec 29, 2012 @ 13:07
    Dan Lister
    0

    Okay so that was a major fail. The href attribute of the link actually prints out {localLink:1075} and not a link to the wiki page.

  • Dan Lister 416 posts 1974 karma points c-trib
    Jan 03, 2013 @ 00:31
    Dan Lister
    100

    I managed to fix this issue by creating a string extension method as follows to parse links within a document type class.

    public static HtmlString ToHtml(this string str)
    {
     return new HtmlString(TemplateUtilities.ParseInternalLinks(str));
    }
Please Sign in or register to post replies

Write your reply to:

Draft