Local Content Pickers

Always use Content Pickers or Multinode Treepickers to connect up arbitary links between webpages.

There are always requirments to create links between nodes, the basic level is that a parent node can have children nodes. Which is a great way to display a relationship for example a listing page with the children being item pages. Everyone can easily understand that you add a new child node and this then appears on the parent page.

The use of a Content Pickers or Multinode Treepickers is when the choice is arbitary. It maybe because you need to pick a favourite child or a link to a specific page elsewhere.

Example of links you might need include:- 

  • Home Page
  • Login Page / Register Page
  • Contact Us Page
  • Cookie Page / Privacy Policy Page

Let the CMS do the work

Global MultiNode TreePickers

Use Mntp to Select Global Data

For convenience place individual global data items into a folder, label the folder in a way that makes sense. For example Put News Items into a News Folder or place Products into a Products Folder. For the video, Events is the folder that holds individual Event items.

 

When creating MultiNode TreePickers allow both the Folder and the Individual items to be picked, in this way the Content Editor can choose either folders of items or individual items if they so choose.

In this way, Global data can be blended together from multiple sources, especially important when we are using Scaffolding and we have Scoped Global Data

Code to output selected Items

Using LINQs SelectMany and Descendants, we can in one line of code blend all the items and all relevant decendants of items selected by the Content Manager into one single list for use later.

 

// Input: OurMultiNodeTreePicker, which is a MultiNode TreePicker pointing to one or more DocTypeWeWant or parents containing DocTypeWeWant
// Output: IEnumerable<DocTypeWeWant>, All the DocTypeWeWant that were selected in the MultiNodeTreePicker

var items = OurMultiNodeTreePicker.SelectMany(e => e.DescendantsOrSelfOfType(ModelsBuilder.DocTypeWeWant.ModelTypeAlias).Cast<ModelsBuilder.DocTypeWeWant>());