This is the fifth segment in a series of posts on how to build a Drupal website from scratch. In the time since I wrote the last Drupal post, I have been learning more and delving deeper into the power and beauty of Drupal, and will be sharing a lot more in future posts, but these next two posts will wrap up the basics of building a Drupal website.

If you’ve been following this series, we have Introduced Drupal, learned how to install Drupal, we then set up and configured a Drupal site, and finally we went over how to build the Drupal site with blocks, menus, and modules. The site that I have been working on concurrently with this tutorial is The Drupal Pad, and everything in these tutorials is implemented on that site.

In this final section, we’re going to look at adding content to our site. We have a pretty basic website at this point, with a basic front page but not much else.

Drupal comes with some inbuilt content “types”, with the ability to create more. This ability to create and custom design your own content types is one of the things that makes Drupal a really powerful CMS, and we will go more into detail on this later. The two main content types built into Drupal are “Story” and “Page”.

By definition, Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles. So you could use the story type to create news articles, blog post type of entries (if you don’t want to enable the blog module), articles, etc. On the other hand, a page is useful if you want to add a static page, like a contact page or an about page. I find myself using pages for things such as Site Disclaimers, Terms of Use, etc.

If you enabled the blog module or the poll module, then you’ll have extra content types, the Poll, and the Blog Entry.

If you are in the admin section and click on “Create Content”, you will be given the option to create one of these content types. Each of them will give you several options, most of which are common to all content types. Let’s look at these options:

1. Title: This is going to be the title of your page, post, poll, etc. It will appear in the page title bar at the top pf your browser. If you have clean urls enabled and have enabled the path and pathauto modules that I mentioned in my Building your Drupal site post, then this title will automatically be used to create your url depending on how you have configured pathauto. For example, if you create a page titled Contact Us, then pathauto will create the url for the page to be, which looks very clean. We will implement this soon.

2. Body: This is where you place the text of your content. If you are creating a story, this is where you place the meat – your article text.

3. Input Type: Right below the the Body box is a link titled Input Type, which you usually have to click to expand. This allows you to specify how you want the text you created to be read by the browser. The default option is Filtered HTML. This allows a selected few HTML tags to be enabled so that your text is formatted to have links, bold, italics, underline, and web page address and emails are enabled. The second option is PHP Code which would allow you to execute an actual PHP script if you have one as part of your body. And the final choice is Full HTML which allows all HTML tags to be executed. These choices become very useful if you have a multi contributor site where you want to control what kind of content people can and can’t put on the site. You don’t want to enable PHP code or full HTML options for all users because they may placa malicious code or scripts onto your website that will harm end users computers. You may not want all users to be able to embed videos or such. These options are available by default in the default content types, but as I mentioned you can create custom content types where you can make these options unavailable.

4. Log Message: This is a useful place to leave messages for yourself and other site contributors/authors on updates to content and such. This is particularly useful for a collaborative project such as a book. It’s not an option I use much because I am the sole author on most of my sites, but I do occasionally leave myself a note such as “verify definition of xxyy, and add link to wikipedia for word xyz” to remind myself of things that I need to work on.

5. URL Path Settings: This option will show up if you have clean urls and the Path module enabled. You have the option here to enter a custom friendly url for your content. If you have pathauto module enabled this field will be pre-populated based on your Titles and you may never need to look at it, because if you set your Pathauto configurations correctly, you will have the url already created and formatted correctly from the get go.

6. Comment Settings: Here you select whether or not you want people to be able to leave comments on the content you’re creating. The default value (Enabled, Read Only, or Read/Write) will depend on the content type. For example, stories have comments enabled by default, whereas pages have comments disabled. You can change and set this for your content type, so you never have to look at it again, or you can change it as you go. For example you may create a controversial article that generates a lot of comments and you want to stop people commenting any further at a future point, you can go into the article and edit it to have comments only be Read Only. Or you may create one article that you don’t want any comments on because you’re the boss and your word on the matter is final, you can disable comments on that one article. So this gives you great control over how users interact with your site and site content.

7. Menu Settings: This is where you set whether you want your content to have a menu entry. You may not be interested in having your specific blog posts in a menu, but you want your Contact Page to appear in the Navigation somewhere.
Title here is what you want the title to be in your menu, and can be the same as or different from your content title. For example you may have a frequently asked questions page where in the page title you have it as “Frequently Asked Questions, but in the menu you just want it to be the abbreviated format FAQ.
– Next is Description which is where you place what you want the reader to see if they hover with the mouse cursor over the Menu Title. It is optional but can be useful. For example, you may want the reader to see “Answers to things people always want to know” when they hover over FAQ. This is particularly useful for someone looking for information who doesn’t want to click and open everything on the menu. Those little hovering descriptions can make navigating easier.
– The next option is Parent Item which is what main menu your item will fall under. For example you may want the Contact Page in the Primary Links at the top of the the page, and the Site Disclaimer in a special footer menu that you’ve created. Weight is a useful feature of Drupal that allows you to order items by giving them a weight. Items with a heavier weight sink to the bottom while those with a lighter weight stay near the top. The weights are numbered from -10 to 10. For example in your primary menu at the top you may want the Home link to always appear first and the Contact Us link to always appear last. You would give them their respective weights accordingly. If you have a menu with your article titles and you want them to be ordered alphabetically, then you give them all a weight of 0.

8. Authoring Information: Here you select your authoring information. The Authore by field is usually prepopulated with your user name, but you can change it. The Authored On field will contain the time of posting if you leave it blank, or you can enter a date and time of your choice.

9. Publishing Options: This gives you several options. First of course is whether or not to publish the content or to leave it in draft form. If you’re not ready to publish it yet you can leave this unchecked until you’re ready. You can promote your content to the front page, for example news items and such, or not, for example contact page, site disclaimer, etc. You can sticky an article or post so it stays at the top of the page or of lists even if you add new content. And finally you can create a new revision of already created content. The publishing options can be set by content type, or you can edit them as you go.

Remember, like I said you can create your own custom content types. And, if you want a lot more flexibility and power, you can add the Content Creation Kit (CCK) module which allows you to add a lot more juice to your content by creating types with all kinds of custom fields. The CCK module is so powerful that it deserves it’s own post, so I won’t delve into that today.

Wow… many options!! Today has been a lot of theory, laying the foundation so that you understand what we’re doing when we start really populating and bulking up our website.

So, in the next post we are going to get our hands dirty and really add the most important part of any website, the content. We will start by looking at the default content types and then add a couple more. Because we want to get it right from the beginning, we will also install the Pathauto module that we’ve been talking about and configure it so that our urls and all that are good to go before we start adding content. We will also create and add menu items, basically exploring and implementing the stuff I described today. If I’m in an adventurous mood, we may also play with some blocks and do other cool stuff. So start gathering the content you want to add to your site, and look out for the next post.

About The Author

1 Comment

  1. Great write-up!
    I’m still a fan of the Joomla CMS though.

    Custom Programming

Leave a Reply