Copied to clipboard

Flag this post as spam?

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


  • Josip 187 posts 652 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>
    
  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Oct 01, 2018 @ 17:57
    Tim Geyssens
    0

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

  • 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