Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Default Content

Security covered Under active development 29,566 sites

This module allows you to include default content and configuration within your modules or install profiles. It exports content as YAML files, simplifying the process of setting up pre-defined data for your Drupal sites.

Overview

Default content gives your module and install profile a way to ship default content as well as configuration.

8.x-1.x is powered by core's serialization, rest and hal modules. The new 2.x version uses a custom normalization format that is optimized for the use case of default content.

Features

2.x

The 2.x branch is actively developed and has the following improvements over the 8.x-1.x version. The new version is however still experimental and might missing some 8.x-1.x features, specifically extensibility and integrations through hal+json normalizers.

  • A more compact YAML-based normalization format
  • Identifiers like ID, revision id, changed and revision timestamps and other fields are no longer exported
  • Built-in support for composite entities like paragraphs in a single file
  • User 0/1 are no longer exported but referenced by ID
  • Support for translations
  • Support for files (stored as files in the same folder as the normalized file enitties, filename must be unique)
  • Support for entity references in link fields
  • Improved support for path fields including the pathauto skip flag

Importing of hal_json based default content is still supported, but exporting can only be done in the new format. Support for the old format will be removed in a future version.

Important

8.x-1.x

Supports entity-references between content.
Supports files if you have File entity
Easily export your content and its dependencies to yml using drush commands.

How does it work

Enable default content first. Any module that requires default content can put YAML (hal+json for 8.x-1.x) versions of the entities inside content/{entity_type} folders.

For example see default_content_test which has

  • modules/default_content_test/content
  • modules/default_content_test/content/node
  • modules/default_content_test/content/node/imported.yml
  • modules/default_content_test/content/taxonomy_term
  • modules/default_content_test/content/taxonomy_term/tag.yml

Requirements

Core only.

Known problems

Please use the issue queue to file any issues you encounter.

Credits

Written by @larowlan in response to Snowman session by @eaton and @yoroy.

Similar projects

Looking for a D7 solution? Try here

Related modules

Ask your assistant about Default Content

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Activity

Tracked releases
2
Tracked since
Aug 2024
Latest release
9 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core PHP Release date
2.0.0-beta1 Pre-release 9–11 Jan 12, 2026
2.0.0-alpha3 Pre-release 9–11 Aug 24, 2024