Bare-Bones Razor Template

For a Razor Web Page (.cshtml file) to serve a standard Experience Management Page template, you should put it in ~/App_Data/PageTemplates and it must at least:

  1. Inherit from the RazorPageTemplate.
  2. Set the TemplateId (GUID) and TemplateTitle (string) properties within the Configure method override.
  3. Declare one XhtmlDocument property with a Placeholder attribute on it. (It will serve as a standard Experience Management content placeholder.)
  4. Call the Markup helper method to render the placeholder property passed as an input parameter.
@inherits RazorPageTemplate
@functions {
    public override void Configure()
    {
        TemplateId = new Guid("bed582d3-d604-4858-a3a7-5b01d39d11e1");
        TemplateTitle = "My First Razor Template";
    }
    [Placeholder(Id = "content", Title = "Content", IsDefault = true)]
    public XhtmlDocument Content { get; set; }
}
<!DOCTYPE html>
<html>
<head></head>
<body>
    @Markup(Content)
</body>
</html>

The above is enough to get a "bare-bones" Razor page template in Experience Management