API Reference: DisplayNameAttribute Class

The DisplayNameAttribute can be applied to content model classes, content model properties, as well as views. The attribute sets the display name of the object in the user interface of the back office application.

For content model classes, this includes places where a new node can be created and dropdowns for adding nested content items. For content model properties, this includes the labels of the properties on content edit forms. For views, this includes the view selection dropdown when creating new pages.

If DisplayNameAttribute is not specified, the display name will be inferred from the object identifier (class name, property name, or view name). The name will be split into words on capital letters, so ContentPage would become Content Page.

Usage

Decorate the content model class, content model property, or view with the DisplayNameAttribute. Pass the display name in the attribute constructor.

Example

In the following example, the display name attribute is applied to a page content model and a content model property.

[Page]
[DisplayName("RSS Feed")]  // Capitalization different from default display name
public class RssFeed: IContentType
{
    [DisplayName("SEO Settings")]
    public SeoContent Seo { get; set; }

    // Display name will be 'Second Paragraph' by convention
    public ParagraphContent SecondParagraph { get; set; }
}

In the following example, the display name attribute is applied to a Razor view.

@inherits RedaktPage<BlogArticle>
@attribute [DisplayName("Blog Post")]
<div class="section">
    <!--  etc...   -->
</div>