Page.modular() not returning true on modular pages

Hello, I’m trying to display a side navigation menu only under certain conditions, one of which is that the page is not modular. I haven’t been able to get the page.modular()method to return true in my twig template when on a modular page. Even a simple {{ dump(page.modular()) }} returns false on both of the modular pages I have. What am I doing wrong? I’m sure the two pages I’m testing are modular.

I think the docs for the method are wrong or the method implementation is wrong. It returns true if the page is a modular child.

Until the mystery is solved, to get if the parent is a modular page, you can use

if (page.template == 'modular')

Aha, that makes total sense, Flavio. Thank you for the clarification and the suggestion to use the page template object. So I wonder when the page.modular() method would be useful, since you can’t directly access a single modular child in the browser as far as I could tell. Maybe when looping through a collection or something?