Content type

A content type is a named template for content items in Drupal, such as Article or Basic page, that sets the fields and publishing defaults of every item.

Learn DrupalDrupal glossary

A content type is a named template for content items in Drupal. It decides which fields, publishing defaults and form settings every item of that type has. Article, Basic page and Vendor are examples. Technically it is a bundle of the node entity type, and it is stored as configuration, so it can be moved between environments.

How content types work in Drupal 11

The Drupal user guide describes a content type as an entity subtype for the content item entity type. In code it is a configuration entity of the type node_type, implemented by the class NodeType. That class extends ConfigEntityBundleBase, and its definition names node as the type it provides bundles for. Each node stores its content type in the type entity key.

A content type stores these settings: name, type (the machine name), description, help, new_revision, preview_mode and display_submitted. Administrators then add fields to the type, and all content items of the type share those fields. The administration pages live under Structure › Content types, and managing them requires the administer content types permission. A bundle machine name can have at most 32 characters.

Example

The user guide builds a Vendor type in these steps:

  1. Go to Structure › Content types and choose Add content type.
  2. Enter the name Vendor and a description.
  3. Set the Title field label to "Vendor name".
  4. Under Publishing options, check Published and Create new revision and leave Promoted to front page and Sticky at top of lists unchecked, as the guide does.
  5. Choose Save and manage fields to start adding fields such as a logo and a website.

Common mistakes

  • Treating the machine name as editable. Drupal core blocks a rename of a saved bundle. Check the machine name before the first save.
  • Expecting new defaults to change old items. The user guide notes that changing the publishing options does not affect content items that already exist.
  • Using a content type for other data. Content types only cover content items. Taxonomy terms use vocabularies and comments use comment types.
  • Mixing up the type and the item. A content type is configuration; the items you create from it are content.

For marketing and content teams

A content type is the shape of a kind of page. Before you ask for a new one, list the pieces of information each item needs, such as a logo, a date or a link, because those become its fields. The Content page has a Content type filter, so editors can list all items of one type.

With DXPR

DXPR Builder works per field of a content type. According to its documentation, you pick DXPR Builder as the format of a field on the Manage display page, and a content type can have more than one such field. See DXPR Builder.

Sources

Questions about Content type

A content type is the template; a content item is one piece of content created from it. Article is a content type, and a single news story is a content item of that type. The type fixes the fields, and each item fills them with its own values.

You can edit the name editors see. The machine name is different: for a saved content type, core throws a ConfigNameException saying the machine name of the bundle cannot be changed. Create a new type and move the content if you need another machine name.

Go to Structure › Content types and choose Manage fields next to the type. When you create a new type, the Save and manage fields button takes you to the same page. Fields added to a type are shared by all items of that type.

Related terms

All Drupal terms from A to Z