Copied to clipboard

Flag this post as spam?

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


  • Karin 2 posts 72 karma points
    May 04, 2016 @ 19:49
    Karin
    0

    Insert/edit Links in Body Text field

    I am new to Umbraco (since Dec 2015). We are using version:
    Umbraco version 7.2.4 assembly: 1.0.5773.18159

    When adding new content to our website and I need to add a link to either an external site, media or different page on our site, Umbraco writes the link and does not link to it correctly.

    The developer I was working with said we need to put in a "hack" to get this to work within Umbraco. So I have this code in many of my templates:

    @{
        var bt = Umbraco.Field("bodyText").ToString()           
            .Replace("src=\"media", "src=\"/media")
            .Replace("src=\"../media", "src=\"/media")
            .Replace("href=\"media", "href=\"/media")
            .Replace("href=\"../files", "href=\"/files")
            .Replace("href=\"files", "href=\"/files")
            .Replace("href=\"../", "href=\"/")
            .Replace("src=\"files", "src=\"/files")
            .Replace("src=\"../files", "src=\"/files");     
    
        @Html.Raw(bt);
    }
    

    I am sure it is something in the configuration but I don't know where to begin looking for it.

    Can someone point me in the right direction? Thanks, Karin

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    May 04, 2016 @ 20:27
    Dennis Aaen
    0

    Hi Karin and welcome to our :).

    So your goal is to insert a link into the internal or external link into the richtext editor.

    Then you can use the link property in the Richtext editor

    enter image description here

    When you click there, you will get the possibility to link to an internal page from your website, or an external URL.

    enter image description here

    If you donĀ“t have the option right now, then you need to ask your developer to configure the Richtext editor data type to include the link option.

    Hope this helps,

    /Dennis

  • Karin 2 posts 72 karma points
    May 05, 2016 @ 12:27
    Karin
    0

    Hi Dennis

    This is not the issue. I can put links in. What happens is the Umbraco changes the links. If someone copies and pastes a link vs selecting the document. enter image description here

    The link looks like this in the source code: enter image description here

    then if that "hack" is not in place and you click on the link, the URL errors: enter image description here

    It adds in the information highlighted in pink. The "hack" addes the / in front of the href="/client so it goes to the root of the site.

    I hope this makes sense. Thanks, Karin

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies