Copied to clipboard

Flag this post as spam?

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


  • greg 4 posts 74 karma points
    Nov 04, 2019 @ 16:06
    greg
    0

    Umbraco Link Picker

    Hi folks

    Having trouble with how to add this to my template. I just need the @link to update with the Link Picker value that's added to the doctype. The alias for the picker is "singleUrlPicker"

    thanks

    @{
    var site = Model.Content.Site().OfType();
    var link = site.Link;   
    }
    
    
        <div class="container">
            <div class="row">
                <div class="col-sm-4">
                    <div class="container briefings">
                        <ul>
                        @foreach(var item in selection){
                            <li>
                            <a class="dont-break-out newsItemLink" href="@link">
                            <h3 style="margin-top: 0px;">@item.Name ><span>></span></h3>
                            <p>@item.Summary</p>
                            <em>@item.CreateDate.ToLongDateString()</em>
                            </a>
                            </li>       
                        }
                        </ul>
                    </div>
                </div>
    
  • Amir Khan 1199 posts 2567 karma points
    Nov 04, 2019 @ 19:36
    Amir Khan
    0

    Is the link picker on each item in the foreach loop or on the homepage of the site?

  • greg 4 posts 74 karma points
    Nov 04, 2019 @ 21:16
    greg
    0

    Thanks Amir

    Yes the doctype uses a list view and each news instance that is added there is a summary and a link picker inside it.

    The link wraps the summary. Hope thats clear.

    This is for the news instances

    @{
    var selection = CurrentPage.Site().FirstChild("newsArea").Children("newsItem").Where("Visible").OrderBy("UpdateDate desc");
    }
    

    Do i need to include this in the 'site' var?

    CurrentPage.Site().FirstChild("newsArea").Children("newsItem")
    
  • 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