Micro-content
Provides a lightweight, reusable content entity type with bundle support for creating small, field-enabled content snippets that support revisions and translations.
microcontent
Install
composer require 'drupal/microcontent:^2.0'
composer require 'drupal/microcontent:8.x-1.8'
Overview
Micro-content is a Drupal module that provides a lightweight, reusable content entity type designed for creating small pieces of structured content. Unlike full nodes, micro-content entities are intended for smaller, reusable content snippets such as testimonials, person cards, ratings, or career outcomes.
The module provides a bundle system (micro-content types) that allows site builders to define different types of micro-content with their own field configurations. Each micro-content type can have a description and a CSS class to help content editors visually distinguish between types in the admin interface.
Key capabilities include full revision support with revision logging, translation support for multilingual sites, entity ownership tracking, publish/unpublish workflow, and integration with Drupal's content moderation system when enabled. The module also provides Views integration for creating custom listings and an Entity Browser integration for selecting micro-content in entity reference fields.
Features
- Custom content entity type (microcontent) with configurable bundle types (microcontent_type)
- Full revision support with revision user, timestamp, and log message tracking
- Translation support for multilingual content management
- Entity ownership tracking with author information
- Publish/unpublish workflow with status field
- Content Moderation integration - enforces revisions when moderation is enabled
- Views integration with custom views data for building admin listings and frontends
- Entity Browser integration with modal display for selecting existing or creating new micro-content
- JSON API support with filter access for published/unpublished content
- Contextual links support for quick editing from rendered output
- Field UI integration for adding custom fields to micro-content types
- Bundle-based permission granularity for fine-grained access control
- CSS type class support for admin theme customization to distinguish content types visually
- Preview view mode for displaying micro-content in admin contexts
Use Cases
Testimonials and Quotes
Create a 'Testimonial' micro-content type with fields for quote text, author name, author title, company, and photo. Use this to manage client testimonials that can be referenced from multiple pages without duplicating content.
Person Cards
Create a 'Person Card' micro-content type for staff or team member profiles with fields for photo, name, title, bio, and contact information. Reference these cards in team pages, article author bios, or event speaker listings.
Ratings and Reviews
Create a 'Rating' micro-content type with fields for rating value, review text, reviewer name, and date. Use for product reviews, course ratings, or service feedback that can be displayed in multiple contexts.
Call-to-Action Blocks
Create a 'CTA' micro-content type with headline, description, button text, and link fields. Allows content editors to create reusable call-to-action components that can be placed in various page layouts.
Feature Highlights
Create a 'Feature' micro-content type with icon, title, and description fields for highlighting product or service features. Reference these in landing pages, comparison tables, or feature matrices.
FAQ Items
Create a 'FAQ' micro-content type with question and answer fields. Manage FAQ content centrally and reference it in multiple FAQ pages or contextually relevant content areas.
Tips
- Use the Type class field when creating micro-content types to add CSS classes that help visually distinguish different types in the admin interface
- Consider enabling 'Create new revision' by default for types where you want to track content history
- Use the preview view mode to customize how micro-content appears in admin listings and entity browsers
- When using Entity Browser, the module provides a ready-to-use browser configuration with both selection and inline creation capabilities
- Micro-content types support all standard Drupal field types, so you can create complex structured content with images, formatted text, entity references, and more
- The module integrates with JSON API for headless/decoupled architectures - micro-content can be exposed as API resources
Technical Details
Admin Pages 8
/admin/structure/microcontent-types
Lists all micro-content types. From this page you can add new types, edit existing types, manage fields, configure form and display settings, and delete types.
/admin/structure/microcontent-types/add
Form for creating a new micro-content type with label, machine name, description, type class for styling, and revision settings.
/admin/structure/microcontent-types/manage/{microcontent_type}
Form for editing an existing micro-content type's settings including label, description, type class, and revision behavior.
/admin/content/microcontent
Administrative listing of all micro-content entities. Shows preview, type, author, status, updated date, and operations. Supports filtering by label, type, author, and publication status.
/admin/content/microcontent/add
Selection page showing available micro-content types. Click on a type to create new micro-content of that type.
/admin/content/microcontent/add/{microcontent_type}
Form for creating a new micro-content entity of the specified type. Form fields depend on the fields configured for the micro-content type.
/admin/content/microcontent/{microcontent}/edit
Form for editing an existing micro-content entity. The canonical URL redirects to the edit form since micro-content is admin-only content.
/admin/content/microcontent/{microcontent}/delete
Confirmation form for deleting a micro-content entity. This action cannot be undone.
Permissions 9
Hooks 2
hook_preprocess_microcontent
Prepares variables for microcontent templates. Sets up the microcontent entity, view_mode, name (label), and content variables for theming.
hook_jsonapi_microcontent_filter_access
Controls JSON API filter access for microcontent entities. Allows filtering among all entities if user has 'view unpublished microcontent' permission, or among published entities if user has 'access content' permission.
Troubleshooting 5
You must create at least one micro-content type before creating content. Go to Administration > Structure > Micro-content types and click 'Add micro-content type'.
Ensure you have the 'access microcontent overview' permission. This permission is separate from content creation/editing permissions.
Ensure the Entity Browser module is installed and enabled. The Entity Browser configuration is only installed when the module is available.
Check the micro-content type settings to ensure 'Create new revision' is enabled. If using Content Moderation, revisions are automatically enforced.
Ensure you have either 'view unpublished microcontent' permission (for all content) or 'access content' permission (for published content only).
Security Notes 4
- The 'administer microcontent types' and 'administer microcontent' permissions are marked as restricted - only grant to trusted administrators
- Bundle-based permissions allow granular control over who can create, edit, and delete specific types of micro-content
- View access to unpublished micro-content requires explicit 'view unpublished microcontent' permission
- Consider using Content Moderation workflows for micro-content that requires editorial review before publication