Conut document children that are show in navigation

Mateusz Żebrowski asked on October 9, 2015 15:09

How to write a Macro which counting all document's children that have "show in navigation" property set on true?

Correct Answer

Brenden Kehren answered on October 9, 2015 15:25

I've used this in the past and it seems to work.

if(Documents[CurrentDocument.NodeAliasPath].Children.WithAllData.Where("ClassName = 'cms.menuitem' AND DocumentMenuItemHideInNavigation = 0").Count > 0) { true } else { false }
1 votesVote for this answer Unmark Correct answer

Recent Answers


Mateusz Żebrowski answered on October 12, 2015 07:53

You don't need "WithAllData" in this case

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 12, 2015 17:24

You're correct, I had some other fields in my WHERE condition I removed and should have removed that prior to posting. Good catch!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.