Skip to main content

How to Generate Demo Content in Drupal 9, 10, and 11: A Comprehensive Guide

Drupal is an open-source CMS for web development. When we start creating a new website on the Drupal CMS, we first install Drupal on the server. At this point, there is no default content available in the CMS. We have two ways to proceed with development:

  1. Manually create the content, which can be very time-consuming, especially considering the number of content types, users, menus, and terms involved.
  2. Automatically generate all this content with just one click.

I’m sure you’ll prefer the second option. So, let's discuss how we can streamline the lengthy process of content creation into a single click.

Assuming you have already completed the Drupal setup, you can refer to this link for detailed instructions on how to install Drupal. Let's start with the steps.

Step 1:- Install the required module.

To install the Devel module using Composer, use the following command:

composer require 'drupal/devel:^5.2'

Step 2:- Enable the module

To enable the module, you can use Drush via the command line, or you can visit the /admin/modules page, search for the Devel and Devel Generate modules, and enable them. The commands to enable the modules are:

drush en devel
drush en devel_generate
Image
Devel Modules

Step 3:- Configuration page of the generate content

Now, visit the /admin/config page where you will find the Generate panel. This panel offers multiple options such as Generate Block Content, Generate Content, Generate Menus, and more or you can visit the /admin/config/development/generate url to see the above options.

Image
Devel Generate

Step 4:- Generate the content

Next, click on "Generate Content" You will see a form where you can select the content type, specify the number of nodes to generate, and adjust other configurations. Choose the appropriate content types and generate the content accordingly.

Image
Generate Content

Now, you can check on the content page that the demo content has been created.

 

We can also use the drush commands to create the content. The devel module has some drush commands to perform the above functionality. To generate the demo content using drush command here are the commands

drush genc // Content
drush genbc // Block Content
drush genmd // Media Items
drush genm // Menus
drush genv // Vocabularies
drush gent // Terms for specific vocabulary
drush genu // Users

For more information visit the following page https://drushcommands.com/drush-8x/devel-generate/

Below is the tutorial video for generating the dummy content.

Related Articles