API Reference: AllowAtRootAttribute Class

The AllowAtRootAttribute can be applied to content model classes. The attribute specifies that the content model can be used for the root page (homepage) of a site, or a root asset or folder in an asset library. If AllowAtRootAttribute is not specified on a content model, it can not be used for a root node of a node collection. If no content models are decorated with this attribute for a specific node collection type (site or asset library), all content models can be used for root nodes of that node collection type.

Typically, the homepage content model (for sites) and one or more folder content models (for asset libraries) will be decorated with this attribute. This attribute together with the AllowChildrenAttribute determine the type structure of a node collection hierarchy.

Usage

Decorate the content model class that you want to be able to use for a root node 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 the collection root by default.

Example

The following example specifies that a page content model of type Homepage can be used for the root node of a site node collection.

[Page]
[AllowAtRoot]
public class Homepage: IContentType
{
    // ...
}