Macro in Master page Layout

Nicholas Gornall asked on May 24, 2017 09:51

Hi all,

I am trying to use a macro in the master page layout but can't get the macro to run. When using:

"<div class='{% CurrentDocument.NodeAliasPath %}'>"

The below HTML is output:

"<div class="{% CurrentDocument.NodeAliasPath |(user)user.name|(hash)1111111111111111111111111111111111111111111111111111111111111111%}"

I noticed that in the in the DancingGoat sample site used macros in the Master page layout. Is there a setting that I need to turn on?

Cheers, Nick

Correct Answer

Prashant Verma answered on May 24, 2017 10:19

Hi Nick,

In master pagelayout macro not reslove because its a ASCX type which supports server tag's only if you want to use you need to simply use server tags instead of macro's.

<div class="<%= CurrentDocument.NodeAliasPath %>"></div>

Thanks

Happy to help you

0 votesVote for this answer Unmark Correct answer

Recent Answers


Rui Wang answered on May 24, 2017 18:00

Nick, you need to know where macro can be used versus .net expression.

web part properties, rich text area, e-mail templates, Text/XML transformations or HTML page layouts are typically the places.

for the master page layout, you need to double check if you are using ASCX or HTML page layout.

0 votesVote for this answer Mark as a Correct answer

Nicholas Gornall answered on May 26, 2017 03:46

Thanks Prashant. That was exactly what I was after!

0 votesVote for this answer Mark as a Correct answer

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