Excluding item from collection using categories

Hi.

It is possible to show a certain number of posts, according to their category, in a given post, not including the one being viewed.

Example:

Thanks

Yes, but you’ll need a custom template I suppose

I am using a Gantry particle to display content from Grav. The particle specific code to define the page collection is this:

{% set attr_extra = particle.extra | attribute_array %}
{% set article_settings = particle.article %}
{% set filter = article_settings.filter %}
{% set sort = article_settings.sort %}
{% set limit = article_settings.limit %}
{% set start = limit.start + max (0, ajax.start | int) %}
{% set display = article_settings.display %}
{% set collection = grav.page.collection (
     {
         items: {'@ taxonomy.category': filter.categories | split ('')},
         order: {by: sort.orderby, dir: sort.ordering},
         url_taxonomy_filters: false
     },
     false) %}
{% set total = collection.count () %}
{% set pages = collection.slice (start, limit.total) %}

With this code I get this result:

You can see the same article on the cards below. I would like that in the article or main post, it does not appear in the lower list of cards.

I think you could filter current page out before these two lines

{% set total = collection.count () %}
{% set pages = collection.slice (start, limit.total) %}

But there might be a better way. I’m not familiar with Gantry

Hi.

The pages are already filtered before the lines you propose.
I have tried with @ self-siblings on the line:
items: { ‘@self.siblings’: filter.categories | split (’ ') }, and I have obtained the desired result, but for this, I must have the pages at the same level, not being able to apply this filter to all the pages of the site, regardless of the level at which they are.