Create custom page attributes

IMPORTANT: This article documents functionality that is no longer the recommended approach when adding dynamic fields to pages. The information below it is available for migration purposes only, in case you were using custom page attributes in Sitefinity CMS versions prior to 7.0, when custom fields for pages were introduced. To follow the officially recommended approach, check the  Add custom fields to pages article.

Custom fields of modules in Sitefinity CMS is a widely used feature. You can extend built-in modules by adding various types of fields to the data stored in these modules. This feature comes with Custom page attributes. The following article explains how you can use them.

NOTEBackend pages and group pages do not support custom fields.

Creating a custom page attribute

You create custom page attributes through configuration, and you can only use the user interface for it. To create a new custom attribute, perform the following:

  1. In the main menu, click Administration » Settings » Advanced
  2. In the tree view on the left, click ContentView » Controls » FrontendPages » Views
  3. To edit the view for creating pages, click FrontendPagesCreate and perform the following:
    1. To open the section where your custom attribute will appear, click Sections »AdvancedOptionsSection » Fields.

      NOTE: You can also choose any other section, not only Advanced Options.

    2. To create the attribute, click Create New.
    3. From the list that appears, choose TextFieldDefinitionElement.

      NOTE: You can also choose other types of attributes, such as ChoiceFieldElement, HierarchicalTaxonFieldDefinitionElement, and FlatTaxonFieldDefinitionElement.

    4. In the DataFieldName textbox, enter the name of the persistent field where you want to store the value of the attribute. This name must be prefixed with Attributes. This is a convention Sitefinity CMS uses to distinguish custom page attributes from the rest. If you want your field to be named DemoField, then enter Attributes.DemoField.
    5. In the FieldName textbox, enter the name of the field without any prefix.
    6. In the FieldDefinitionTitleCaption textbox, enter the Title of the field. This value appears in the user interface, while the Name value is used by the system.
    7. Click Save Changes.
  4. To edit the view for editing pages, click FrontendPagesEdit.
    1. To create the attribute in the edit view, perform again Step 3a to Step 3f and use the same field name and title.
    2. Click Save Changes.

Editing the value of a custom page attribute

Once you have created a custom page attribute, you can edit its value when creating or editing a page. For information about creating a custom attribute, see Creating a custom page attribute earlier in this article.

To edit the value of an attribute, perform the following:

  1. In the main menu, click Pages.
  2. If you want to set an attribute when creating a new page, click Create a page.
  3. Enter a title for the page. For more information, see Edit and delete a page.
  4. Expand the section where you created the custom attribute. For example, expand the Advanced options section.

    The custom attribute that you created appears in the section. Depending on the type you selected, there may be different user interface for editing the value. If you selected TextFieldDefinitionElement, a textbox appears.

  5. In the textbox, enter the value for your custom attribute.
  6. Click Create and go to add content.
  7. Click Publish.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?