Copied to clipboard

Flag this post as spam?

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


  • Martin Amsinck Andersen 17 posts 103 karma points
    Jun 09, 2016 @ 09:31
    Martin Amsinck Andersen
    0

    Inserting curly braces as link in rte

    Hello

    I'm trying to insert curly braces {0} in the RTE link.

    The reason for that is that the RTE html is used in a mail template, where it gets replaced via string.format().

    But when i insert, for some reason, umbraco changes the url from "{0}" to "/umbraco/{0}".

    enter image description here

    Is there a setting or something else i can set to avoid this?

  • MarcC 49 posts 356 karma points
    Jun 09, 2016 @ 10:03
    MarcC
    0

    Not sure how you are targetting it with string.Format but if you can pick it up can you a prefix and String.Replace('x','') and make your link x{0} or something along those lines?

    Ive tried with whitespace but no luck.

    I couldnt say why it is linking this way though, interesting to know, it seems to happen with any link that starts with a special character such as { , ! , @ etc..

  • Martin Amsinck Andersen 17 posts 103 karma points
    Jun 09, 2016 @ 10:23
    Martin Amsinck Andersen
    0

    The string format is used when i get the content from the RTE, in a APIController, before rendering the mail. The replace could work in simple cases, but potentially, the string could have x multiple places.

    ah, ok, haven't tried with other characters, and yes, would be interesting to find out.

  • MarcC 49 posts 356 karma points
    Jun 09, 2016 @ 10:53
    MarcC
    0

    When you say the string can have x multiple places do you mean it may be {0}{1}{2} etc..?

  • Martin Amsinck Andersen 17 posts 103 karma points
    Jun 09, 2016 @ 10:57
    Martin Amsinck Andersen
    0

    Exactly, and the main text could potentially contain a "/umbraco/" that shouldn't be replaces

  • MarcC 49 posts 356 karma points
    Jun 09, 2016 @ 11:03
    MarcC
    100

    Ah I see, what I meant was not to replace the '/umbraco/' but a custom string and start the link with that.

    So say the custom string you choose to use is 'foo' your link in would be:

    'foo{0}{1}{2} '

    (you will want to pick something very ungeneric..)

    Then allow your code to either check for the full prefix 'foo'

    Or a better solution may be that you know 'foo' is 3 characters and will always appear at the beginning, so you could trim off the first 3 characters and then do your string.Format?

    M

  • Martin Amsinck Andersen 17 posts 103 karma points
    Jun 09, 2016 @ 11:11
    Martin Amsinck Andersen
    0

    Thanks Marc, sounds like a temporary solution.

    I'll mark this as resolved at post it in the issues instead, thx again

  • MarcC 49 posts 356 karma points
    Jun 09, 2016 @ 11:32
    MarcC
    0

    Best of luck mate, let me know if you find a true solution!

  • marcelh 171 posts 471 karma points
    Feb 17, 2017 @ 15:39
    marcelh
    0

    Hmm, just ran into the same issue today. Why is it that link placeholders (like {url}) are prefixed with /umbraco/ ? And is that somehow possible to disable?

    Note that when prefixing the placeholder with the scheme, like http://{url} the /umbraco/ prefix is not inserted. Don't really like to include explicit scheme references in my templates, though.

Please Sign in or register to post replies

Write your reply to:

Draft