Why would I want to create different content types?

Submitted by Marc on Wed, 09/01/2010 - 10:05pm

In a previous entry I wrote about a couple of default content types that Drupal creates and the difference between those two content types. In this entry I will expand on the idea of why you will want to create many more different content types of your own.

When you enable many modules, you will notice that those modules have created new content types. For instance, when you enable the (optional core) Blog module, you will see that it creates a content type of Blog. Content types give you a way to organize the content on your website. But, they do so much more than just that.

[Note that the following points deal with more advanced usage of the Drupal CMS. Nonetheless, they provide compelling arguments for the need to create custom content types. So, do yourself a favor and get in the habit of creating custom content types as your needs dictate. It is so easy to do, even as a complete beginner. Later on, as you progress in your ability to use Drupal, you will be so glad that you have taken this first step!]

  • You can create custom template files for each content type. So, when Drupal renders the page for that content type it will use the template file that you have created. So, instead of using node.tpl.php, it might use node-blog.tpl.php. (Drupal will pick it up automatically as long as you also have node.tpl.php in the same directory in your theme.) Or, you might create a suggestion like page-nodetype-blog.tpl.php to override page.tpl.php (this requires modifying template.php for your theme).
  • When you build views you will often want to filter by a particular "Node: type".
  • Each content type can have different specialized fields that you can add with CCK.
  • When you use Pathauto (and you will definitely want to use this on your site) you can specify different path names to be generated for the different types. Look at the URLs for the different blog entries on this site. I generate them using tokens with Pathauto.

I hope that as you are building your Drupal site, you will give some thought to how you are going to architect and organize it and will decide to create custom content types.