Allow At Root attribute

API Reference: AllowAtRootAttribute Class

The AllowAtRootAttribute can be applied to page and content models. The attribute specifies that this model can be used for the root page (homepage) of a site, or the root library item in a content library. If no pages or content models are decorated with this attribute, all page or content models respectively can be used as root models.

Usage

Decorate the page or content model class with the AllowAtRootAttribute. The attribute does not require any parameters. The attribute is not inherited, so if you have decorated this attribute on a base class of this model, the derived class is not allowed at root as well.

Default Convention

If AllowAtRootAttribute is not specified on a page or content model, it can not be used as the root page or library item, unless no pages or content models have been decorated with this property, in which case all page or content models are allowed at root.

Example

[AllowAtRoot]
public class Homepage: IPageModel
{
    // ...
}

This example specifies that a page of type Homepage can be used as the page model for the root page of a site.