In this article

Allow Children attribute

The AllowChildrenAttribute can be applied to page models (IPageModel) and content models (IContentModel). The attribute specifies the page or content models that may be used for children of a page or content with this model. This allows you to restrict types within the page and library tree structure. For library content, setting allowed children implicitly configures this content model as a folder in the library structure.

Usage

The attribute can be applied multiple times on the class. All types from all applied attributes are added to the allowed child model list. The attribute is not inherited, so any allowed child model that you have specified on a base class of this model will have to be specified explicitly on derived model classes.

Pages

Decorate the page model class with the AllowChildrenAttribute. Pass the allowed model types in the constructor. The types must implement the IPageModel interface. Passing a type that does not implement IPageModel will result in an invalid configuration error on system startup.

If you do not want to allow any child pages for this page model (resulting in leaf nodes in the page structure), apply AllowChildrenAttribute without any parameters.

Library folders

Decorate the content model class with the AllowChildrenAttribute. Pass the allowed model types in the constructor. The types must implement the IContentModel interface. Passing a type that does not implement this interface will result in an invalid configuration error on system startup.

Default Convention

If AllowChildrenAttribute is not specified on a page or folder content model, there is no restriction on allowed models for its children, and children of this page or folder can have any applicable model that exists in the system.