Copied to clipboard

Flag this post as spam?

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


  • René Andersen 238 posts 684 karma points
    Apr 18, 2013 @ 09:03
    René Andersen
    0

    I need a simple Razor snippet for showing related links

    Hello everybodyCan someone help me with a simple Razor snippet for showing links from the build in Related Links in Umbraco?Thanks in advance!//René

  • René Andersen 238 posts 684 karma points
    Apr 18, 2013 @ 09:17
    René Andersen
    1

    I have just figured it out. But i can't delete this topic, so do not spend time answering this topic. :-)

    @inherits umbraco.MacroEngines.DynamicNodeContext

    @{
        if (Model.HasProperty("relatedLinks"))
        {
    <ul class="side-nav">
    @foreach (var link in @Model.RelatedLinks)
    {
        string target = link.newwindow == "1" ? " target=\"_blank\"" : "";
    <li>
    @if (link.type == "internal")
    {
    <a href="@umbraco.library.NiceUrl(int.Parse(link.link))"@Html.Raw(target)>@link.title</a>
    }
    else
    {
    <a href="@link.link"@Html.Raw(target)>@link.title</a>
    }
    </li>
    }
    </ul>
        }
    }

  • 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