Mark Handy
Mark Handy

Reputation: 1256

Kentico 9 Hierarchical transformations for a menu system

My end goal is to have a page that displays a Heading then links.

The Heading text would come from child folder, and the links would be pages within that folder.

I'm not concerned about the actual HTML at this point, but say an h2 for the header, an LI for each link.

I had thought i could create a repeater with a transformation to grab the folder name, and then all the sub nodes, but i'm struggling here since I've never tackled something like this in Kentico before, and have never attempted to build a navigation system using hierarchical transformations.

Here's my current content tree

When rendered, Missed Payments should have the following code. When i add mew pages to Group and Flex, page links are shown

<h2>Group</h2>
<ul>
  <li><a href='link to overview'></a>Page Name</li>
  <li><a href='link to deductions'></a>Page Name</li>
</ul>
<h2>Flex First</h2>

I have a Header, Item and Footer transformation types, with Header, Link and Footer transformation. The HTML is simple, but i'm missing the piece to bring it all together.

Upvotes: 1

Views: 283

Answers (1)

Laura Frese
Laura Frese

Reputation: 331

Have you looked at the Creating a Mega Menu using Hierarchical transformations how to on Kentico?

For your level 0 header have <ul><li>

Level 1 header have

<ul>
<li><h2><a href="{% Documents[NodeAliasPath].Parent.NodeAliasPath #%}">{% Documents[NodeAliasPath].Parent.DocumentName #%}</a></h2></li>
<li>

All levels item: <a href="{% Transformation.GetDocumentUrl() #%}" >{%DocumentName%}</a>

All level separator: </li><li>

Footer: </li><li>

Make sure transformation type is Text/XML

Upvotes: 1

Related Questions