Defining content

    Here you'll find an explanation of how content is defined and quick guide for your first go at it (based on an empty installation).

    Before a piece of content can be created it needs to be defined. That is why, when opening a blank installation of Umbraco, it is not possible to create content in the Content section. All content needs a blueprint that holds information about what kind of data can be stored on the content node, which editors are used, how it is organized, where in the structure it is allowed and so forth. This blueprint or definition is called a Document Type.

    What is a Document Type?

    In it's most basic form a document type is a form containing fieldsets (or tabs) where you can apply rules about where the content can be created, which template(s) are allowed, backoffice icon and so forth.

    Document Types can define entire pages or more limited content that can be reused on other nodes ie. a SEO tab. This means that you are in complete control of what type of content can be created where.

    Properties

    Each field on a Document Type is called a property. A property is given a name, an alias (used to output the properties content in a template) and an editor. The editor determines what type of data the property will store and the input method. There are a wide range of editors available out of the box (textstring, Rich text, media picker and so forth) and you can customize and add additional editors.

    Some editors require configuration, a configured editor is saved as a Data Type and can be re-used for multiple properties and document types. These can be seen in the Developer section under Data Types.

    Creating a Document Type

    A Document Type is created in the settings section using the Document Type editor.

    Go to the Settings section in the backoffice. On the Document Types node click the menu icon (•••) to bring up the context menu. Here choose Document Type. This will create a new Document Type with a template (can be found under Templates in the Settings sections) that will be assigned as the default template for the document type.

    Creating a Document Type You can also choose to create a Document Type without a template and create folders to organize your Document Types.

    Defining the root node

    First we're prompted to give the Document Type a name. This first Document Type will be the root node for our content, name it "Home".

    Naming a Document Type Notice that the alias of the Document Type is automatically generated based on the name. If you want to change the alias simply click the "lock" icon.

    Having a root node makes it easy to query content as you know everything will be under the root node.

    To set an icon for the Document Type click the document icon in the top left corner. This will open the icon select dialog. Search for Home and select the icon. This icon will be used in the content tree, choosing appropriate icons for your content nodes is a good way to give editors a better overview of the content tree.

    Choosing an icon for the Document Type

    Go to the Permissions tab and tick the Yes - allow content of this type in the root checkbox and save the Document Type by clicking save in the bottom right corner.

    Allow at root

    Creating the root node

    Now go to the Content section, click on the menu icon next to Content and Select the Home Document Type. We'll name it "Home" and click the Save and Publish button.

    First content created

    As we haven't created our own properties all we can see on the "Home" node is the Properties tab which contains the default properties that are available on all content in Umbraco.

    Let's add some properties of our own.

    Tabs and properties

    Go to the Settings section, expand Document Types by clicking the arrow to the left and select the Home Document Type.

    Adding tabs

    Before we start adding properties to the Document Type we need to create a tab to hold the property.

    Click Add new tab and name the tab "Content".

    Creating tabs If you have multiple tabs and/or properties you can order them with drag and drop or by entering a numeric sort order value. This is done by clicking Reorder.

    Adding properties

    Now that we have created a tab we can start adding properties. Let's add a Rich Text editor to the Content tab.

    Click the Add property link in the Content tab. This opens the property settings dialog. Here you can set the meta data for each property (name, alias, description), choose which data type/property editor to use and add validation if needed.

    Give the property a name, the name will be shown to the editor so make relevant and easy to understand. Notice the alias is automatically generated based on the name. We'll name this "Body Text".

    Adding a property

    Keyboard Shortcuts

    Keyboard shortcuts are available when you are working with the Document Type editor. To see which shortcuts are available simply click ALT + SHIFT + K:

    Keyboard Shortcuts

    Property editors

    Clicking Add editor will open the Select editor dialog. Here you can choose between all the Available editors (this will create a new configuration) or Reuse already configured editors. To make it easier to find what you need use the search field to filter by typing "Rich". Filtering will display configured properties first (under Reuse) and all available editors under that.

    Select the Rich Text editor under Available editors.

    Choosing the Rich Text editor

    This will let you configure the editor settings - the Rich Text editor for this property. Notice that the name of the Data Type (Home - Body Text - Rich Text editor) is based on the name of the Document Type, the name of the property and the property editor. Let's rename it to "Simple Rich Text editor" and only select the most necessary options.

    • bold
    • italic
    • alignLeft
    • alignCenter
    • link
    • umbMediaPicker

    When you are happy with the settings click Submit.

    Checking the Mandatory checkbox makes the property mandatory and the content cannot be saved if no value is entered (into the Richtext editor in this case). You have the option to add additional validation by adding a regular expression in the Validation field.

    Submit the property and save the Document Type. If you go to the Content section and click on the Home node you will now se the Content tab with the Body Text property.

    Defining child nodes

    Next up we'll create a simple text page Document Type that will be used for subpages on the site.

    Go back to the Settings section and create a new Document Type and name it "Text Page". Add a tab called "Content" and this time we'll add two properties. First make a property called summary using the Textarea editor and secondly create a property called "Body Text" and reuse the Simple Rich Text Editor Data Type.

    Creating child nodes

    Before we can create a Text Page in the Content section, we need to allow the Text Page Document Type to be created as a child node to the Home node. Select the Home Document Type and go to the Permissions tab. Click Add child and select Text Page.

    Allowing child nodes

    Go to the Content section and click the menu icon (•••) next to the Home node and select the Text page Document Type. We'll name the page "About us". We now have a very basic content structure.

    Basic content structure

    Document Types are very flexible and can be used in a myriad of ways from defining a piece of reusable content or an entire page, to acting as a container or repository.

    More information

    Related Services

    Tutorials

    Umbraco TV