When you are developing a new Drupal website, you often need to populate it with dummy content. Manually added content is tedious and wastes time. Fortunately with just one Drush command, you can generate as much dummy content as you want.
The Devel Generate module, which comes with Devel, has some Drush commands built in to generate dummy content. If you haven't already installed the Devel module, you can install and enable it with Drush:
$ drush dl devel
$ drush en devel -y
Even though Devel Generate comes with Devel, it needs to be enabled separately. So without further ado, enable it with Drush:
$ drush en devel_generate -y
Devel Generate provides a command called generate-content. It takes two arguments, the number of nodes to create and the maximum number of comments per node.
If you want to create 20 nodes and no comments, you will use the following:
$ drush generate-content 20
You can see the nodes by going to admin/content:
If the content type has a image field, it will create a dummy image. This is what an article looks like with a dummy title, image and body content:
It is quite common for Drush commands to have an alias. An alias is a shorter version of the command and makes it easier to type. The alias for generate-content is genc. To repeat the above with the alias:
$ drush genc 20
If you want to create comments as well, add in the second argument. The following will create 20 nodes and a maximum of 10 comments per node.
$ drush genc 20 10
You can even delete nodes before creating new ones with the kill option.
$ drush genc 2 10 --kill
If you have created specific content types, you can specify a content type, so Devel Generate will generate just that type of content. To generate 20 nodes that belong to the Latest News content type:
$ drush genc 20 --types=latest_news
To generate 20 Latest News nodes with a maximum of 10 comments and delete existing content, use:
$ drush genc 20 10 --kill --types=latest_news
If you don't want to use Drush to generate the content, you can also do it the old fashioned way by going to the following path on your site: admin/config/development/generate/content.