Copied to clipboard

Flag this post as spam?

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


  • Mohammad Ali 8 posts 78 karma points
    Nov 07, 2017 @ 11:12
    Mohammad Ali
    0

    How to add external Link in Top Menu

    Hi Gorgeous People,

    I am new to Umbraco, before i was using dashboard of Umbraco only but now i have to create one external link in top menu which is other website link or outside of my website root. I checked there is one option when i creating new link which is internal or external. But one i use external link it is not accessing the direct link its goes like example.com/otherwesbite . I have no idea How i will fix this. Basically I dint use asp.net before. Can you please help me to fix this issue. In partial view i found a file which is _topmenulink and it shows like this:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage @using Archetype.Models; @using Archetype.Extensions;

    @{ var homepage = CurrentPage.AncestorsOrSelf("HomePage").First();

    if (homepage.HasValue("topLink"))
    {
        var links = homepage.GetPropertyValue<ArchetypeModel>("topLink");
        foreach(var item in links)
        {
            if(item.HasValue("internalLink"))
            {
                <li@(item.GetValue("linkText") == CurrentPage.Name ? " class=current" : string.Empty)><a@(item.GetValue("Target") == "New tab/window" ? " target=_blank" : string.Empty) href="@Umbraco.TypedContent(item.GetValue("internalLink")).Url">@item.GetValue("linkText")</a></li>
            }
            else
            {
                <li@(item.GetValue("linkText") == CurrentPage.Name ? " class=current" : string.Empty)><a@(item.GetValue("Target") == "New tab/window" ? " target=_blank" : string.Empty) href="@item.GetValue("externalLink")">@item.GetValue("linkText")</a></li>
            }
        }
    }
    

    }

    please guide. Thanks.

  • Mohammad Ali 8 posts 78 karma points
    Nov 07, 2017 @ 11:29
    Mohammad Ali
    0

    Any help guys??

  • Mohammad Ali 8 posts 78 karma points
    Nov 07, 2017 @ 13:33
    Mohammad Ali
    0

    any body can help me to get out this situation. Umbraco is so annoying.. I must say.

  • Jeffrey Schoemaker 408 posts 2138 karma points MVP 8x c-trib
    Nov 08, 2017 @ 07:07
    Jeffrey Schoemaker
    0

    Hi Mohammed,

    sorry to hear that it's not working for you, but I think it's really hard for you to change these things when you have no background in .NET software development, and also didn't attend any of the Umbraco courses. If you have to work more often with Umbraco I would highly recommend taking an Umbraco Course (online or near you; https://umbraco.com/training/).

    Another good option is a subscription to umbraco.tv (https://umbraco.tv/).

    For know I could take a look, but then you have to give me a bit more input. Can you share maybe some screenshots of Umbraco and the frontend of what you want to achieve, because only based on your problem definition and the code I can't really figure it out.

    Regards, Jeffrey

  • Mohammad Ali 8 posts 78 karma points
    Nov 08, 2017 @ 07:15
    Mohammad Ali
    0

    Thanks Jeffrey for your kind advice. Actually nobody in our office for website maintenance that is why they assign me this work to do that. Basically what we want is, there is one top navigation on my website and i want to add link which is "Our Brands" and this will go to another website. I attached screenshot for you to check :

    enter image description here

    This image shows the availability in CMS I can add internal and external link. But when i add external link it goes to www.mywebsite/www.example.com instead of directly goes to www.example.com.

    my first comment shows the coding of _toplinkmenu.

    Let me know if you need anything else to share.

    Thank you so much .

  • Jeffrey Schoemaker 408 posts 2138 karma points MVP 8x c-trib
    Nov 08, 2017 @ 07:24
    Jeffrey Schoemaker
    0

    Aah, so you're the lucky one that get's the chance to explore working with Umbraco :) You should be feeling lucky ;)

    In this case it looks like if you change 'www.example.com' to 'http://www.example.com' or 'https://www.example.com' it would already work. Could you check that?

    Pro-tip: You should add a description to "External link" where you specify how to enter an url. "You could enter an external link here, including http:// or https://. For example http://www.example.com"

    Good luck and have a beautiful day,

    Jeffrey

Please Sign in or register to post replies

Write your reply to:

Draft