Liquid: filter collection where not null?


#1

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

Thanks