Copied to clipboard

Flag this post as spam?

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


  • Josip 195 posts 662 karma points c-trib
    Oct 01, 2018 @ 17:31
    Josip
    0

    Exclude current page from list

    I want exclude dinamicly current page from list. See image below: http://prntscr.com/l0y06s This is my current code:

     <main class="newsItem">
        <section class="container">
            <div class="row">
                <div class="col-sm-4">
                    @{
                        var image = Model.Content.GetPropertyValue<IPublishedContent>("newsImage");
                        if (image != null)
                        { <img class="img-responsive center-block" src="@image.Url" /> }
                    }
    
    @{
        var selection = Model.Content.Site().FirstChild("news").Children()
                            .Where(x => x.IsVisible())
                            .OrderBy("UpdateDate desc");
    }
    <ul>
        @foreach(var item in selection){
            <li>
                <a href="@item.Url">@item.Name</a>
            </li>
        }
    </ul>
                </div>
                <div class="col-sm-8">
                    <h1 class="text-primary">
                        <strong>@Umbraco.Field("newsTitle") </strong>
                    </h1>
                    <h3>
                        <strong>@Umbraco.Field("newsSubtitle")</strong>
                    </h3>
                    <p>
                        @Umbraco.Field("newsBody")
                    </p>
                </div>
            </div>
        </section>
    </main>
    
  • Comment author was deleted

    Oct 01, 2018 @ 17:57

    Try updating your .Where(x => x.IsVisible()) by also checking in the x.Id != Model.Content.Id

Please Sign in or register to post replies

Write your reply to:

Draft