You are hereBlogs / Randall Knutson's blog / What's in a Node?

What's in a Node?


By Randall Knutson - Posted on 21 March 2009

What is in a node?  Everything!

What is the basic structure of a blog post?  There is a title and a body.
What is the basic structure of a comment? There is a title and a body.
What is the basic structure of a forum post? There is a title and a body.
What is the basic structure of a webpage? There is a title and a body.

Are you getting the idea here?  On the web, just about everything can be reduced down to a very similar form.  This is why in Drupal, most content is abstracted into something called a node.  A node can be a blog post, a forum, a webpage, a poll, a story, an article or anything else you can think of.  As a website is designed, the different types of content for that site are defined so that they can be displayed in different places.

If there is a type of content that needs more than a title and a body, there is a module called CCK that makes it possible to add more fields to a node.  There are dozens of different CCK field types you can add like phone number, website link and emfield.  Emfield is cool because it allows you to embed media files into your website easily.  For example, if you want to add a youtube video to a page, it is as simple as copying and pasting the link into a CCK field.  CCK has become so integral to Drupal that in Drupal 7, CCK will be rolled into the main distribution as the "fields" option.

Sometimes content needs to be extended even further than what CCK can do.  This is where custom modules come in.  Need a poll?  There is a poll module in core.  More often than not someone has already written a module to extend nodes in whatever way you want.  If not, a custom module can always be created.

Having all the content as nodes is one of the huge advantages that Drupal has over other Web CMS platforms.  Because all the content is stored the same, it can be treated the same.  For example, the views module can be used to select certain fields from certain content types and display them on a page.  This is how "Most commented articles" or "Recent blog posts" are created on websites.   With views you have tremendous freedom over how you want to display your content.

Another advantage is the ability to add additional functionality to any content type.  By adding modules like fivestar or addthis a website can go from web 1.0 to 2.0 in a hurry.  With other web CMS platforms adding this functionality would need to be done for the forum module, again for the blog module, and every other module for content on the site.  Because of nodes the functionality can be added to any content type that is a node, this saves you time and money because it only has to be done once and it looks consistant across the website.