Drupal Content Types — Creating and Managing Custom Content Types
In this tutorial, you'll learn to create and manage Drupal content types, including the default Article and Basic Page types, creating custom content types with custom fields, managing display modes, and following best practices for content architecture design.
What You'll Learn
- Default content types in Drupal: Article and Basic Page
- Creating custom content types through the admin interface
- Content type settings including workflow, preview, and submission options
- Adding fields to content types and configuring their display
- Comment, menu, and revision settings per content type
- Display modes and form modes for different content presentations
Why It Matters
Content types are the foundation of your Drupal site architecture. Every piece of content on your site belongs to a content type that defines what fields it has, how it behaves, and how it displays. Well-designed content types make content entry intuitive for editors and enable flexible front-end presentation. Poor content type design leads to content inconsistency, editorial confusion, and expensive rework.
Real-World Use
A university redesigns its website by creating content types for Courses (with fields for Instructor, Schedule, Credits, Prerequisites), Faculty Profiles (Photo, Bio, Department, Research Areas), and Events (Date, Location, Category, Registration Link). Each content type has its own form display for editors and custom view modes for listing pages, featured cards, and full pages. Content editors enter structured data without needing developer assistance.
Learning Path
flowchart LR A[Admin Dashboard] --> B[Hosting] B --> C[Content Types] C --> D[Fields] D --> E[Taxonomy] E --> F[Entity System]
Default Content Types
Drupal's Standard installation profile provides two default content types:
Article
The Article content type is designed for time-sensitive content like news posts, blog entries, and press releases. It includes:
- Title (machine name: title)
- Body (field_body): Text area with summary
- Image (field_image): Single image upload
- Tags (field_tags): Taxonomy term reference
- Authored by, Authored on, Changed: Automatic metadata
Basic Page
The Basic Page content type is for static content like About Us, Contact, and Privacy Policy pages. It includes:
- Title (machine name: title)
- Body (field_body): Text area
- Authored by, Authored on, Changed: Automatic metadata
Creating a Custom Content Type
Navigate to Structure > Content types > Add content type (or /admin/structure/types/add).
Basic Settings
- Name: Human-readable name, e.g., "Event"
- Description: Explain the purpose, e.g., "Use Events for upcoming workshops, conferences, and meetups."
- Machine name: Auto-generated from name, e.g.,
event. Can be edited during creation.
Submission Form Settings
Configure how the content creation form behaves:
- Title field label: Default is "Title", can be changed per content type
- Preview before submission: Optional, mandatory, or disabled
- Submission guidelines: Help text appearing above the form
Publishing Options
Default publishing behavior for new content:
- Published: Automatically publish new content
- Promoted to front page: Show on the front page
- Sticky at top of lists: Keep at top of sorted lists
Display Settings
- Display author and date: Show author name and publish date on the content page
- Display the title: Show or hide the content title
Menu Settings
- Available menus: Select which menus can have links added from this content type's edit form
Revision Settings
- Create new revision: Automatically create a new revision on each edit
- Require revision log message: Force editors to explain their changes
Workflow and Moderation
- Content moderation: Enable content moderation workflow for this content type (requires Content Moderation module)
Adding Fields to Content Types
After creating the content type, add custom fields via the "Manage fields" tab at /admin/structure/types/manage/{type}/fields.
Add Field Workflow
- Click "Add field"
- Choose a field type (Text, Number, Image, Entity reference, Date, etc.)
- Configure field settings:
- Label: Human-readable name
- Machine name: Auto-generated, e.g.,
field_event_date - Help text: Instructions for content editors
- Required: Make the field mandatory
- Configure field storage settings (cardinality, allowed values)
Example: Adding a Date field to Event
# Field configuration (via admin UI)
Label: Event Date
Machine name: field_event_date
Field type: Date
Widget: Date and time picker
Default value: blank
Required: true
Example: Adding an Entity Reference field
# Field configuration
Label: Speaker
Machine name: field_speaker
Field type: Entity reference
Referenced entity type: User
Widget: Autocomplete
Required: false
Display Modes
Display modes control how content appears in different contexts. Navigate to Structure > Content types > Manage display.
Default Display Mode
The default display mode controls the full content page view. Drag fields to reorder, and configure each field's formatter:
- Title: Hidden (rendered by the page template)
- Body: Formatted text summary or full
- Image: Image with specific image style
- Tags: Entity reference label
- Authored by: Author name linked to profile
Teaser Display Mode
The teaser mode is used in listing views and is typically more compact:
- Body: Trimmed to a specific character limit
- Image: Small thumbnail image style
- Tags: Entity reference label, comma-separated
Creating Custom Display Modes
- Navigate to Structure > Display modes > View modes
- Click "Add view mode"
- Enter name and machine name
- Assign the view mode to entity types
- Configure field display at Manage display > Custom display settings
Custom display modes are powerful for showing the same content differently on different pages.
Form Modes
Form modes control which fields appear on the content creation form. Navigate to Structure > Content types > Manage form display.
Default Form Mode
The default form mode shows all configured fields. You can:
- Reorder fields by dragging
- Change widget type per field
- Configure widget settings (rows for textarea, allowed values for select lists)
Custom Form Modes
Create simplified forms for specific user roles. For example, a "Contributor" form mode might hide SEO and publishing options fields.
# Custom form mode: Simplified Editor
Field visibility:
- Title: visible
- Body: visible
- Image: visible
- Tags: visible
- SEO settings: hidden (available only in Default mode)
Content Type Best Practices
Naming Conventions
- Use plural names for content types that represent collections: Articles, Events, Products
- Use singular machine names: article, event, product
- Keep machine names short but descriptive
Field Choices
| Content Type | Recommended Fields |
|---|---|
| Event | Date, Location, Registration link, Category (taxonomy) |
| Product | Price, SKU, Product image, Category, Description |
| Profile | Photo, Job title, Bio, Department, Email, Phone |
| Case Study | Client, Industry, Results, Testimonial, PDF download |
Content Architecture Principles
- One content type per content concept: Do not reuse a content type for multiple purposes
- Fields over body text: Structured data is more useful than unstructured body content
- Entity references for relationships: Use taxonomy or entity reference fields instead of duplicating data
- Consider the editorial experience: Content types should make entry intuitive, not overwhelming
Content Type Export
Content types and their fields can be exported as configuration:
drush config:export --destination=../config/sync
The content type configuration is stored in YAML files:
# config/sync/node.type.event.yml
uuid: abc123
langcode: en
status: true
name: 'Event'
type: event
description: 'Use Events for upcoming workshops, conferences, and meetups.'
help: ''
new_revision: true
preview_mode: 1
display_submitted: true
Field configuration is stored separately:
# config/sync/field.field.node.event.field_event_date.yml
uuid: def456
langcode: en
status: true
field_name: field_event_date
entity_type: node
bundle: event
label: 'Event Date'
required: true
translatable: false
default_value: { }
settings:
datetime_type: datetime
field_type: datetime
Common Mistakes
- Creating too few content types: Using a single "Page" content type with a "type" select list field instead of creating proper content types. This makes display configuration, permission assignment, and Views filtering much harder.
- Naming content types inconsistently: Mixing singular and plural names (e.g., "News", "Events", "Faculty Member") creates confusion. Choose a convention and stick to it.
- Adding too many fields to one content type: If a content type has more than 20 fields, consider splitting it into related content types connected by entity references.
- Not using display modes: Showing the same fields and layout on list pages and full pages results in wasted space. Create teaser display modes for listing views.
- Ignoring field permissions: When a content type has sensitive fields, use the Field Permissions module to restrict who can view or edit specific fields by role.
Practice Questions
- What is the difference between a display mode and a form mode in Drupal content types?
- If you need to create a "Job Posting" content type with fields for Company, Location, Salary Range, and Application Deadline, which field types would you use for each?
- How would you design content types for a real estate listing site with properties, agents, and property inquiries? Explain the field architecture and entity relationships.
- Challenge: Design a content architecture for a conference website with content types for Sessions, Speakers, Sponsors, and Venue. Create at least three content types with appropriate fields, entity references between them, and display modes for listing pages and full pages. Export the configuration using Drush.
FAQ
Mini Project
Goal: Build a complete content architecture for a job board website.
- Create three content types:
- Job Posting: Fields for Company (text), Location (text), Salary Range (text), Description (text formatted), Application URL (link), Category (taxonomy term reference), Expiration Date (date)
- Company Profile: Fields for Logo (image), Description (text formatted), Website (link), Size (select list), Industry (taxonomy term reference)
- Testimonial: Fields for Client Name (text), Quote (text formatted), Company (text), Rating (integer, 1-5)
- Configure display modes: Default (full page) and Teaser (listing card)
- Set up form displays appropriate for each editor role
- Enable revision tracking for Job Postings
- Export all configuration using
drush config:export
What's Next
Content types are containers; now learn how to fill them with structured data using the fields system. After fields, organize your content with taxonomy for powerful categorization and filtering.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro