Andre
Andre

Reputation: 181

Kentico Macro to Get Page Type

I'm new to Kentico and am using version 9 for a website. A graphic designer asked me if I could create a macro or code that adds the page type of a page to the body tag as a css class. Has anyone done this before?

Upvotes: 3

Views: 1511

Answers (4)

Colin
Colin

Reputation: 1846

DocumentContext.CurrentPageInfo.ClassName

Upvotes: 0

Chetan Sharma
Chetan Sharma

Reputation: 1442

<body class="{% CurrentDocument.NodeClass.ClassName.ToString() #%}">

Upvotes: 5

Zan RAKOTO
Zan RAKOTO

Reputation: 911

I use Kentico 8.2 version and I can get this using:

<body class="anotherClass {% ClassName #%}">...</body>

Maybe this work also in Kentico 9.

Hope this help!

Upvotes: 2

Roman Hutnyk
Roman Hutnyk

Reputation: 1549

Following is a macro, that gives you page type info object:

{% DocumentContext.CurrentDocument.NodeClass #%}

Go to System -> Macros -> Console to see/try available macros.

Upvotes: 7

Related Questions