# Liquid: filter collection where not null?

**URL:** <https://talk.jekyllrb.com/t/liquid-filter-collection-where-not-null/888>\
**Category:** Help\
**Created:** [August 9, 2017, 10:49am UTC](https://talk.jekyllrb.com/t/liquid-filter-collection-where-not-null/888 "2017-08-09T10:49:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kurren123](https://avatars.discourse-cdn.com/v4/letter/k/dfb087/32.png) [@Kurren123](https://talk.jekyllrb.com/u/Kurren123)\
**Post date:** [August 9, 2017, 10:49am UTC](https://talk.jekyllrb.com/t/liquid-filter-collection-where-not-null/888/1 "2017-08-09T10:49:50Z")

</div>

Hi

In my front matter I have:

```
---
layout: default
title: "Services"
top-navigation:
    order: 2
---

```

The `top-navigation` is only on _some_ pages. Using liquid I want to filter all site pages which have a `top-navigation` property and sort by `order`.

I’m trying `sort:'top-navigation.order'` but that’s throwing an exception of `undefined method [] for nil:NilClass`.

How can I filter for pages that have `top-navigation` and then sort?

Stack overflow post: [https://stackoverflow.com/questions/45588558/liquid-filter-collection-where-not-null](https://stackoverflow.com/questions/45588558/liquid-filter-collection-where-not-null)

Thanks
