Creating a sidebar menu using view rendering and RenderingModel

In the previous recipe, you learned rendering simple field values in the layout itself. In this recipe, we will create a sidebar menu control using view rendering and RenderingModel and place them statically on layouts.

Getting ready

For this recipe, we will use the same layout file created in the previous recipe.

How to do it…

We will first create a template with some common fields required on all the content items of the site:

  1. Create one Common Fields data template with the Title, Body, Show in Menu, Image, and Icon fields. From its standard values, set Title as $name and tick the Show in Menu checkbox field. Also, from Layout Details, assign Main Layout to it, which we created in the ...

Get Sitecore Cookbook for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.