Kentico CMS 8: How to Keep Your Content Consistent and Well-structured
In this blog post I will show you what restrictions can be applied to content editors to ensure your site structure remains consistent and well-structured.
Structure of the content
There are several document types included out of the box in Kentico CMS for most common types of documents (News items, Articles, Blog posts, etc.). A document type is, simply put, a definition of custom properties for a document to store relevant data within the document data itself (News release date, title, summary and description, for instance). You can either customize the properties of predefined document types or create completely new ones to suit your needs.
If you are a site owner, content administrator or designer, your first step when creating a new web site will be to design the structure of documents based on these document types.
Let's say you have a site with several sections as depicted in the screenshot below. I will focus on the
News section that has a list of the latest news from your company and the
Blogs section that displays employee blogs:
The
News and
Blogs sections are represented by the Page (Menu item) document type, which is the predefined type for a common page.
In the
News section, you want the editors to publish the latest company news. The News document uses a page template which is configured to display all news items situated in this section. It would only confuse editors to be given the option of choosing document types, as any type they'd select other than News wouldn't show on the live site due to the template's configuration. So best ot keep other document type options hidden.
In the
Blogs section, you want employees to create and manage their blog posts. Their access rights are limited, so they don't have access to content sections other than their own blog. You want them to be able to create only Blog month or Blog post document types.
So let's see how you can achieve this.
Defining allowed child types
In this chapter, let's focus on the
Blogs section. You want to ensure that employees can only create new months (type: Blog month) and posts (type: Blog post) under their own blog (type: Blog). If you want to limit allowed document types on a document type basis, you can define the allowed child types settings available in the editing user interface of the specific document type. This option has been available since the very first versions of Kentico CMS.
As you can see in the screenshot above, the Blog document type has only two allowed child types - Blog month and Blog post, which is exactly want we want.
One thing I want to highlight here is that these restrictions are applicable to the document type. So they will therefore be applied to any newly created document under that document type, no matter where in the content tree it resides.
Creating document type scopes
Since we have the News section ready, we need to set up restrictions for it. Version 8 comes with a new feature
— Document type scopes — which allows you to define a set of allowed document types for a specific content section.
The screenshot above shows the editing user interface of a document type scope. As you can see, you need to define the content section using the path selector as well as the list of allowed document types. For the
News section we want the editors to only be allowed to create news items.
One additional benefit when selecting only one allowed document type is that when an editor creates a new document under this scope, she doesn't have to select from list of available document types, but she is automatically redirected to the correct editing form.
Give us feedback
Do you have any additional questions or comments about this new feature? Please let me know in the comments below.