Copied to clipboard

Flag this post as spam?

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


  • strawberrylatte 34 posts 103 karma points
    Mar 16, 2021 @ 06:32
    strawberrylatte
    0

    How to redirect page to the link from Multi URL picker

    @{ var link = Model.Value("link"); if (link != null) {

  • } }

    I tried using this but, instead of automatically redirects the page to the link, there is another page with the link from the multi url picker. Help is very much appreciated

Copy Link
  • strawberrylatte 34 posts 103 karma points
    Mar 16, 2021 @ 06:44
    strawberrylatte
    0

    Anyone?

    Copy Link
  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Mar 16, 2021 @ 07:31
    Dave Woestenborghs
    0

    Hi,

    Do you want to redirect or do you want the link to be opened ?

    I think you will not see the link on your page anyway because you have no text in it. You could change the code to this to have the text of the link displayed

    @{
    var link = Model.Value<Link>("link");
    if (link != null)
    {
    <li><a href="@link.Url" target="@link.Target">@link.Name</a></li>
    }
    }
    

    Dave

    Copy Link
  • strawberrylatte 34 posts 103 karma points
    Mar 16, 2021 @ 08:03
    strawberrylatte
    1

    Hi Dave, I would like the link to be opened, as of now, the pageonly shows a the link from my multi url picker

    Copy Link
  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Mar 16, 2021 @ 08:10
    Dave Woestenborghs
    0

    When do you want this to be opened ?

    • When the user clicks on the link
    • Or when the user visits the page that has picker on it

    Dave

    Copy Link
  • strawberrylatte 34 posts 103 karma points
    Mar 16, 2021 @ 08:36
    strawberrylatte
    0

    When user clicks the page that has picker in it

    Copy Link
  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Mar 16, 2021 @ 09:16
    Dave Woestenborghs
    0

    Hi,

    In that case you should have a look at this : https://our.umbraco.com/Documentation/Reference/Routing/routing-properties#umbracoredirect

    You can add a field with alias umbracoRedirect to your doctype that uses a content picker as property editor.

    Than the redirect will happen automagically.

    Dave

    Copy Link
  • strawberrylatte 34 posts 103 karma points
    Mar 17, 2021 @ 04:58
    strawberrylatte
    0

    Hi Dave,

    I tried this, but, I realized that its only allow redirects to nodes. What I'm trying to accomplish is to go to external links, for example, google

    Copy Link
  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Mar 17, 2021 @ 07:39
    Dave Woestenborghs
    1

    Hi,

    Than you could do this :

    @{
    var link = Model.Value<Link>("link");
    if (link != null)
    {
    Response.Redirect(link.Url)
    // or Response.Redirect(link.Url, true)
    }
    }
    
    Copy Link
  • Please Sign in or register to post replies

    Write your reply to:

    Draft