Exclude current page from range

Found some similar threads but none of which worked for my case. I’m trying to exclude the current page from a list defined by the below range:

<div>
    {{ range first 5 ( where .Site.RegularPages "Section" "news" ) }}
    {{ $image := .Page.Resources.GetMatch .Params.featured_image }}
    <div>
        <div>
            <img src="{{ $image.RelPermalink }}">
        </div>
        <div>
            <a href="{{ .RelPermalink }}"><h2>{{ .Params.title }}</h2></a>
        </div>
    </div>
    {{ end }}
</div>

For context, this is displaying the latest five news items as part of a sidebar on an article page.

Help appreciated!

{{ range where .FirstSection.RegularPages "Permalink" "ne" .Permalink }}
2 Likes

Works like a charm–thank you!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.