Defining components, content types, and templates
Now that you have seen the functionality of the content and component types provided with the project template, we will review how they were defined in more detail, and then we will define some custom page types to show a catalog of Northwind products.
Reviewing the standard page type
We will review the simplest page type, used for standard pages like About Us.
- In Visual Studio Code, expand
Models
, openStandardPage.cs
, and note that standard pages do not currently have any custom properties, as shown in the following code:using Piranha.AttributeBuilder; using Piranha.Models; namespace NorthwindCms.Models { [PageType(Title = "Standard page")] public class StandardPage : Page<StandardPage> { } }
- Click in
Page<StandardPage>
and press F12 to view the source. - Click in
GenericPage<T>
and press F12 to view the source. - Click in
PageBase<T>
and press F12 to view the...