How to figure out Master Pages path

Digital Team asked on December 13, 2017 16:11

Hi,

I have a few master pages in the document tree with the same master template, in the template I have a repeater which uses a "Path" attribute. The thing is, if you open any of the child pages, the dynamic path changes taking as reference the child node and breaks dynamic path. The path needs to be dynamic.

How can I get the path from the nearest master page to be able to write a absolute path to the child element.

I hope this is clear enough to get the idea. Thanks

Correct Answer

Jan Hermann answered on December 14, 2017 09:07

You can use macros in the Path property:

node = Documents[NodeAliasPath];
while (!node.NodeTemplate.PageTemplateShowAsMasterTemplate && !node.DocumentPageTemplate.PageTemplateShowAsMasterTemplate) {
  node = node.Parent;
}
node.NodeAliasPath+"/%";
0 votesVote for this answer Unmark Correct answer

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