Design file - nest item based on page content


(Hopkinsd1) #1

Hello,

 

Within my design I am trying to get the following functionality to work.

 

If a page has any child pages, display a list of links to those pages. However if that page has content I don't want that list of links to be displayed.

 

So far I have the following.

 

A design file that has a "has_children" show_if design area, that nests an asset listing if the page has children. This show_if has print="no" so that I can call it in the relevant part of my page.

Further down in my page I then have 

My trouble is, I don't know how to create the logic that will only print the "check_for_children" is the page has no content in the "page_body".

 

I hope that makes sense.

 

Thanks

David


(Nic Hubbard) #2

Could you move the logic into a Paint Layout instead? Then you could use the empty: keyword modifier to see if the asset_contents_raw is empty.


(Anthony) #3

Another thought... will pages that have children but no content EVER get any content and need to suddenly start showing it dynamically? If not, then sounds like you should use a folder asset for the ones that only have children, and use the page asset only for the ones that do have content. That way you can have a paint layout with two different type definitions - one for folders that nests an asset listing that gives links to the children, and one for the standard pages that prints their contents.