Skip to content

TreeNode.ToPageIdentity() Extension

Trevor Fayas edited this page Jan 2, 2022 · 1 revision

As we seek in the Baseline to not reference any Kentico APIs, including the TreeNode, we instead have the PageIdentity class, which contains the basic identifiers of a page.

To facilitate easily going from a TreeNode to a PageIdentity, we have an Extension method treeNode.ToPageIdentity() (in namespace Generic.Libraries.Extensions). This converts a TreeNode to the PageIdentity.

When going from a Page Template to a View Component, you can easily pass this PageIdentity model to your view component and have all the context you should need to pull in related pages (either child items by path, or Related Pages by NodeID, etc).

See this in work on the Tab Parent Page Template and it's View Component.

Clone this wiki locally