parent Document

web dev asked on January 4, 2019 12:09

hello kentico dev i want to get the documentName on this tree i try this macro {% Documents[NodeAliasPath].Parent.DocumentName#%} but i get only the first parent i have this structure==> Image is there any macro to get this documentName

Correct Answer

Dragoljub Ilic answered on January 4, 2019 13:51

Hi,

If your data is always structured in the same way, then you can apply macro like this: {% Documents.Where("ClassName = 'CMS.MenuItem' AND NodeLevel = 1").Filter(CurrentDocument.NodeAliasPath.StartsWith(NodeAliasPath))|(identity)GlobalAdministrator%}, but this will work only if the structure of the content is always same.

Best regards, Dragoljub

0 votesVote for this answer Unmark Correct answer

Recent Answers


Jan Hermann answered on January 4, 2019 14:08 (last edited on December 10, 2019 02:31)

Actually a path macro would be better:

{% Documents[Path["{0}"]].DocumentName |(identity)GlobalAdministrator%}

2 votesVote for this answer Mark as a Correct answer

web dev answered on January 4, 2019 14:11

Thank you all it worked

0 votesVote for this answer Mark as a Correct answer

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