This is a cheat sheet for building page types with the Episerver PageTypeBuilder, I recommend you bookmark it. On a day-to-day basis, I have to create a lot of Episerver page types. When building page types, I always seem to find myself turning to Google as I have forgotten some syntax. I have created this quick reference sheet filled with quick code snippets to help any Episerver developer quickly look up the syntax if they find themselves in the same boat ⛵⛵⛵

The snippet above can be copied and pasted into a class to create an Episerver page type. As you can see I've added the attributes for the page-type level and the attribute level. On the class level, you need to apply the [PageType] attribute. This attribute has several properties you can extend. These include:

  • Name: The name that appears in the CMS

  • Filename: Location to the view file

  • DefaultChildSortOrder: The sort order

  • Description: The description in the page type picker within the editor

  • SortOrder: The order it appear in the page type picker model within the editor

  • AvailablePageTypes: DEfines what page types a content editor can create below it

To define a property you apply the PageTypeProperty attribute onto a property. This comes with these properties:

  • EditCaption: The property name

  • HelpText: The text that appears on the hep icon in the editor

  • SortOrder: The order the property appears in the editor

  • UniqueValuePerLanguage: SHoudl the property work with more than one language, or should it default to the default version?

  • Required: Is the property mandatory. The content editor will not be able to save the page otherwise

  • Searchable: Will it be indexed in the search

  • Type: The backing type, image, string, etc..

  • DefaultValueType: Default value

  • Tab: What tab the property appears within

Property DropDownList: Below shows the config required to render a dropdown list

Tab: Below shows the config required to define a custom tab within the editor

Custom Properties: Below shows the config required to create a render a custom property

Cheatsheet over 🎤⬇️💥. Happy Coding 🤘