Ignore taxonomy url filters

Hey all,

I’m using programatically generated page collections throughout a site I’m working on to handle some slightly more complex navigation needs. So all the menus are generated using something like:

{% set a = { items: '@root.children.visible',  'order': {'by': 'default', 'dir': 'asc'}, 'pagination': false } %}             
{% set main_pages = page.collection(a) %}

The problem is that on any page where there’s a taxonomy filter in the URL (eg the blog archive page), my navigation is also filtered - so the navigation disappears!

Seems like a simple problem - but I can’t seem to find any way of getting page collections to ignore taxonomy in the URL?!

I’ve searched through the page collection documentation, and the forums but can’t seem to find an answer.

Thanks!

Andrew

Anyone have any ideas? Surely it must be possible to produce page collections for navigation purposes without it reading the URL taxonomy filter?

I’ve been playing with this a bit. I still find myself stabbing in the dark when following the docs and API definitions.

Try something like '@pages.all.visible', or '@pages.all' and page.collection(a).visible on the next line.

It sounds like what you reported is unexpected behaviour and may be a bug. I can’t think why @root.children should take into account any active filter.

@hughbris thanks so much for getting back to me - I tried a few other possible combinations to try and achieve the same effect:

items: {'@page.children': '/home'}
items: { '@root.children'}
items: {'@root.descendents'}
items: {'@root.descendents.visible'}

Should all work in my particular case - but they’re all affected by the URL taxonomy filter. As you say - seems like it shouldn’t affect @root queries, or page.collection should have an option to ignore URL filters?

Really sounds like a bug. Would you be happy reporting this as an issue on Github? You could simply link this thread, since you described it fairly well here. Ideally provide a way to reproduce it.

Sorry I don’t have more time right now, or I’d try reproducing it myself, have a go at investigating the cause, and reporting it.

Shame we can’t even find a workaround. Anyone else?

Great - I’ve reported it as an issue on Github with a link to the forum as you suggested :slight_smile:

Thanks!

1 Like

Well done! Just to complete the loop for anyone stumbling across this:

I also stumbled across this via google and the solution is to add:
url_taxonomy_filters: false to the item collection.

flowers:
  items: '@self.children'
  url_taxonomy_filters: false