Sharepoint 2013 - Content Types

Today we will look more in-depth at Content Types in Sharepoint.

From my previous post, you should already know that Content Types are a way to group related columns together, so they can be re-used in many different lists, improving efficiency and consistency. But Content Types can do much more that just that.

Content Types are primarily used for two things - aiding in creating a list, and required for creating pages. Today we will focus on how Content Types are required in creating a page, and in the next post, we will see how content types are useful in creating lists.

Content Types and Page Layouts

When you create a new page layout, that page layout must be linked to a content type. You can insert slots within the page layout where the information from the content type data is displayed. For example, we can insert a slot in the page layout to display the last updated date of the page, and this information is stored in one of the site columns within the content type. A different content type might have different site columns that the page layout might not be able to extract from, and thus a page layout must always be linked to exactly one content type; however, a content type can have multiple page layouts.

For example, let's say we have a content type of 'Content Page', with the fields 'Title', 'Intro', 'Author' and 'Body Text'. We can have a page layout where everything is centered on the page, and another one where the author column is not shown and everything is aligned left. We can create two page layouts for that one content type and switch between the two.

When you create a new page, what actually happens is Sharepoint takes the information from the content type, feed it into the page layout and give the final page back as pure HTML. Thus, selecting a content type is a requirement for creating a page.

Below you can see the standard interface you get when creating a new page. Here you can see we must pick a page layout. Since a page layout must be tied to a content type, we are also selecting a content type by association.

Interface encountered when creating a new page

And on the page, there is an option under the 'Page' ribbon where you can select from the available page layouts.

Option for changing between different page layouts

Other Uses

Workflows, events and policies can be bound to Content Types.

Content Types can be configured to have required columns, which must be filled in in order for the entry to be accepted. It is a good idea to set a default for these columns, if one exists.

comments powered by Disqus