Content Type Attributes Reference
Content type attributes
Section titled “Content type attributes”[ContentType]
Section titled “[ContentType]”Registers a class as a CMS content type. Required on all page, block, and media types.
| Parameter | Type | Required | Description |
|---|---|---|---|
DisplayName | string | Yes | Name shown in the editor UI |
GUID | string | Yes | Unique identifier. Never change after deployment. |
Description | string | No | Help text shown when selecting the type |
GroupName | string | No | Groups types in the “New page” dialog |
Order | int | No | Sort order within the group |
AvailableInEditMode | bool | No | Whether authors can create instances (default: true) |
[ContentType( DisplayName = "Article Page", GUID = "a1b2c3d4-e5f6-7890-abcd-ef1234567890", Description = "A page for publishing articles", GroupName = "Content", Order = 100)]public class ArticlePage : PageData { }[AvailableContentTypes]
Section titled “[AvailableContentTypes]”Restricts which content types can be created as children or placed in content areas.
| Parameter | Type | Description |
|---|---|---|
Include | Type[] | Only these types are allowed |
Exclude | Type[] | These types are blocked (all others allowed) |
IncludeOn | Type[] | This type can only be created under these parent types |
ExcludeOn | Type[] | This type cannot be created under these parent types |
[AvailableContentTypes(Include = new[] { typeof(ArticlePage), typeof(CategoryPage) })]public class BlogContainer : PageData { }[ImageUrl]
Section titled “[ImageUrl]”Sets the thumbnail icon shown in the content type selector.
[ImageUrl("~/icons/article-icon.png")]public class ArticlePage : PageData { }Property attributes
Section titled “Property attributes”[Display]
Section titled “[Display]”Controls how a property appears in the editor form.
| Parameter | Type | Description |
|---|---|---|
Name | string | Label shown in the editor |
Description | string | Help text below the field |
GroupName | string | Tab where the property appears |
Order | int | Sort order within the tab |
Prompt | string | Placeholder text in the input |
[Required]
Section titled “[Required]”Makes the property mandatory. Content cannot be published without a value.
[Searchable]
Section titled “[Searchable]”Controls whether the property value is included in full-text search.
[Searchable(false)] // Exclude from search indexpublic virtual string InternalNotes { get; set; }[CultureSpecific]
Section titled “[CultureSpecific]”When true, the property has a separate value per language. When false, the value is shared across all languages.
[CultureSpecific] // Each language has its own valuepublic virtual string Title { get; set; }
[CultureSpecific(false)] // Same value in all languagespublic virtual string ProductSKU { get; set; }[ScaffoldColumn]
Section titled “[ScaffoldColumn]”Hides the property from the editing form while keeping it accessible in code.
[ScaffoldColumn(false)]public virtual string InternalId { get; set; }[Ignore]
Section titled “[Ignore]”Excludes the property from CMS entirely — not stored, not editable.
[Ignore]public virtual string ComputedField => $"{FirstName} {LastName}";Editor hint attributes
Section titled “Editor hint attributes”[UIHint]
Section titled “[UIHint]”Overrides the default editor control for a property.
| UIHint value | Editor control |
|---|---|
UIHint.Textarea | Multi-line text area |
UIHint.MediaFile | Media file picker |
UIHint.Image | Image picker |
UIHint.Video | Video picker |
UIHint.Block | Block picker |
[UIHint(UIHint.Textarea)]public virtual string Summary { get; set; }
[UIHint(UIHint.Image)]public virtual ContentReference HeroImage { get; set; }[SelectOne] / [SelectMany]
Section titled “[SelectOne] / [SelectMany]”Creates dropdown or checkbox list from a selection factory.
[SelectOne(SelectionFactoryType = typeof(ColorFactory))]public virtual string Theme { get; set; }
[SelectMany(SelectionFactoryType = typeof(TagFactory))]public virtual string Tags { get; set; }Validation attributes
Section titled “Validation attributes”| Attribute | Effect |
|---|---|
[Required] | Field must have a value |
[StringLength(max)] | Maximum string length |
[StringLength(max, MinimumLength = min)] | Min and max length |
[Range(min, max)] | Numeric range |
[RegularExpression(pattern)] | Regex validation |
[AllowedTypes(typeof(ImageData))] | Restricts content reference to specific types |
Related
Section titled “Related”- Create a Content Type — Step-by-step guide
- Define Properties — Property configuration guide
- Content Modeling — Design principles