Can't find() unless I rename

This is going to sound crazy.

I was doing this in a macro:

{% set showPages = grav.pages.root.find('/shows/active-shows').children %}

I was surprised and frustrated that it didnt work because I was doing the same thing in a template for a different dir. I was putting this into a macro because I need to use it in more than one place.

It was simply not finding those children. And I kid you not, on a whim I renamed the directories in '/shows/active-shows' and then they showed up! I renamed them back to what they were originally, they still were find()able.

I was dumping the cache during this troubleshooting process, and I also have caching turn off in the config. Any thoughts?

What were they named before and what were they named after? Because that doesn’t make a whole lot of sense if your cache was off too.

Oh, they were named:


I renamed them to:


And then they worked! Then I renamed them back to the original… And they still worked! Yes… shocked. Dunno if it matters, I did make the original dirs via the file browser in ubuntu and I renamed them, and back again in sublime. I didnt check permissions or anything before I did it, but they should’ve been ok.

Ok, this makes a little more sense. The numeric prefix is a quick way of denoting whether or not the page is visible in the menu. This is handled in the navigation Twig with the {% if p.children.visible.count > 0 %} or something like that.

Ok that’s a relief, I thought it was something worse. But after I switched it back to the base name without the numeric prefix it was still able to find the pages. Why might that be?

Maybe you are now using code that is not checking the visibility? Maybe after clearing the cache, you won’t be able to see them again? Maybe you added a manual visibility override to these pages?