# Exclude Active Page

**URL:** <https://forum.getkirby.com/t/exclude-active-page/6895>\
**Category:** Questions\
**Tags:** v2\
**Created:** [March 9, 2017, 5:16pm UTC](https://forum.getkirby.com/t/exclude-active-page/6895 "2017-03-09T17:16:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![withlove](https://avatars.discourse-cdn.com/v4/letter/w/f1d935/32.png) [@withlove](https://forum.getkirby.com/u/withlove)\
**Post date:** [March 9, 2017, 5:16pm UTC](https://forum.getkirby.com/t/exclude-active-page/6895/1 "2017-03-09T17:16:28Z")

</div>

Hi there,

working on a project where i pull all the related pages to help with navigation.  
however i would like to exclude the current active page from the list.

what would be the best way to do this? currently toying with this function:

```
<?php foreach($pages->children()->not($activePage)->visible() as $subpage): ?>
 <?php echo $subpage->title(); ?>
<?php endforeach ?>      

```

Thankful for advice.

x

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 9, 2017, 5:23pm UTC](https://forum.getkirby.com/t/exclude-active-page/6895/2 "2017-03-09T17:23:33Z")

</div>

It depends on what pages you are trying to get, `not()` is probably the best option in your case. If you are trying to fetch siblings of a page, you can also set the `$self` parameter to false: [https://getkirby.com/docs/cheatsheet/page/siblings](https://getkirby.com/docs/cheatsheet/page/siblings)

---

<div class="post-metadata">

**Author:** ![withlove](https://avatars.discourse-cdn.com/v4/letter/w/f1d935/32.png) [@withlove](https://forum.getkirby.com/u/withlove)\
**Post date:** [March 9, 2017, 8:21pm UTC](https://forum.getkirby.com/t/exclude-active-page/6895/3 "2017-03-09T20:21:00Z")

</div>

thanks for the response texnixe.

what would be the best way to indicate the current active page, for the not() filter?

the pages are children of ‘Home’:

— Home  
— 1  
— 2  
— 3

x

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 9, 2017, 8:28pm UTC](https://forum.getkirby.com/t/exclude-active-page/6895/4 "2017-03-09T20:28:59Z")

</div>

Try:

```auto
$pages = page('home')->children()->not($site->activePage());
foreach($pages as $p) {
  echo $p->title():
}

```

[https://getkirby.com/docs/cheatsheet/site/active-page](https://getkirby.com/docs/cheatsheet/site/active-page)

---

<div class="post-metadata">

**Author:** ![withlove](https://avatars.discourse-cdn.com/v4/letter/w/f1d935/32.png) [@withlove](https://forum.getkirby.com/u/withlove)\
**Post date:** [March 9, 2017, 8:31pm UTC](https://forum.getkirby.com/t/exclude-active-page/6895/5 "2017-03-09T20:31:37Z")

</div>

> [@texnixe](#):
>
> $site-\>activePage()

works like a charm. interesting to see that activePage() work within the function.

thanks again for the guidance.

x

---

<div class="post-metadata">

**Author:** ![delphin](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@delphin](https://forum.getkirby.com/u/delphin)\
**Post date:** [October 12, 2019, 1:51pm UTC](https://forum.getkirby.com/t/exclude-active-page/6895/6 "2019-10-12T13:51:46Z")

</div>

Hi, i don’t get how to apply the `$self` parameter to false on my code. Right now the current page is displaying on my list.

Here is my code:

```
<?php foreach ($projets = $page->siblings()->published() as $projet): ?>
  <?php snippet('projet-bloc', ['projet' => $projet]) ?>
<?php endforeach ?>
```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 12, 2019, 1:52pm UTC](https://forum.getkirby.com/t/exclude-active-page/6895/7 "2019-10-12T13:52:58Z")

</div>

```auto
<?php foreach ($page->siblings(false)->published() as $projet): ?>
  <?php snippet('projet-bloc', ['projet' => $projet]) ?>
<?php endforeach ?>

```

---

<div class="post-metadata">

**Author:** ![delphin](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@delphin](https://forum.getkirby.com/u/delphin)\
**Post date:** [October 12, 2019, 1:55pm UTC](https://forum.getkirby.com/t/exclude-active-page/6895/8 "2019-10-12T13:55:03Z")

</div>

oh thank you! I tested everything but this one.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:23pm UTC](https://forum.getkirby.com/t/exclude-active-page/6895/9 "2025-02-06T17:23:08Z")

</div>


