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:

scopes_structure.png

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.

scopes_child_types.png
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.


scopes_edit.png
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.

Share this article on   LinkedIn

Jaroslav Kordula

Jaroslav joined Kentico in 2006. He is a Technical Leader in a development team whose main focus is content management. This includes Documents, Custom tables, Media libraries and other related functionality.

Comments

Jaroslav Kordula commented on

Hi Craig, thanks for the comment. Just ignore this pencil icon, please. That's just an internal tool which is not available in public builds :) I will make it disappear form the screenshots.

Craig commented on

Great feature but I am going to ask the obvious... what is the pencil icon next to the scopes tab? : - )

Jeroen Fürst commented on

Hi Jaroslav, That would be even better!!! :)

Jaroslav Kordula commented on

Hi Jeroen,

We're glad you like this feature. Currently the created scope is applied for all users/roles. What we can consider is adding field for a macro to be able to define condition for the scope application (similar to the workflow scope). Using a macro you would be able to define the condition for a specific user or role based on current context. Would this work for you?

Thanks.

Gitesh commented on

great feature ...will save a lot of time for developers..

Jeroen Fürst commented on

This is really excellent and in the top 5 of my wanted list :) Do you have any plans to add functionality to apply scopes for certain roles/users (also for page templates) or will this always be controlled by the content? The benefit of having this in the scopes is that only certain users or roles can add content of a specific type / select a specific page template.

Jaroslav Kordula commented on

Hi guys,

I'm glad you like it.

Ulysses Triantafillos commented on

Great feature!

bedardv commented on

Oh yes!!! My uservoice suggestion ;)

http://kentico.uservoice.com/forums/181374-features-content-management/suggestions/2574277-scope-on-doctype

Thanks Kentico!