Content

by Gisle Hannemyr

This chapter is intended to give you a basic understanding of how to create and manage content using the Drupal CMS using the GUI. It introduces the node-based content types that is part of the Drupal 7 core, with some brief notes about how to use and extend them.

Table of contents

Drupal core modules discussed in this chapter: Blog, Book, Forum, Node, Poll, Tracker.

Drupal contributed projects discussed in this chapter: Book made simple, Diff, Poll Enhancements.

Introduction

Content is of course what web publishing is all about. There is little point in having a website without content.

See alsoThis chapter relies on the terminology defined in Introduction to the Drupal WCMS. Make sure that you've read that chapter before this one.

The Drupal core provides several different sets of tools to deal with content by means of the GUI. The tool set available in Drupal is highly configurable. The following will appear by default if Drupal is installed with the “standard” profile:

  1. Modules: This interface lets the administrator add or remove modules that implements specific content types. For instance to add a Blog entry to the repertoir of content types, enable the core Blog module.
  2. Content » Add content: Select a content type and fill in a content creation form to add content of that type to the site.
  3. Structure » Blocks: Create a block of content, and select the region on the page where the block will appear.
  4. Structure » Content types: Add a new content type, or alter the characteristics of existing content types.
  5. Structure » Taxonomy: Add and edit vocabularies and terms that can be used to categorise content.

The super administrator has access these by default tools. To give other users access, set the appropiate permissions for the user.

Where content appears

There are two different locations to display content on a Drupal website.

As noted in the introduction to Drupal, the main unit of content in Drupal is an “entity”, and the main entity type is “content”, which is also knows as a “node”. Like all Drupal entity instances, a node has a numeric identifier (nid) that uniquely identifies the instance. To view a particular node instance, the user visits a Drupal page identified by a path. The path, in the case of a page registred by the core, consists of the name of the entity and the numeric entity instance identifier (e.g. the path node/42 leads to the node with nid 42).

There may also be custom pages. There is no provision in the Drupal core to create custom pages using the GUI, but they may be created by means of a module. Custom pages are also accessed by means of a path, but the path is defined and registred by the module.

In Drupal, a block is a custom piece of content that is not identified by a path. There is a provision in the core GUI to create simple blocks, and it possible to create a custom block by means of a module. To make a block visible to visitors, the site builder assigns it to a region (an area on the screen defined by the theme template), using the GUI.

tipThe contributed module Views UI provides the site builder with a GUI to create custom pages and custom blocks. It is used to build queries to the content database and display the result of these queries in a page or a block.

Drupal core content types

Drupal has two types of content (entity type “node”) enabled in the default installation profile: Article and Basic page. These two content types represent the most basic form of content in Drupal. Both consist of a title and a body. The Article also have tags and image fields.

The Drupal core comes with several other types (see below) that can easily be turned on by enabling the core module that implements the type. Beyond this, the developer can extend Drupal with even more content types as follows:

  1. By selecting Structure » Content types » Add content type. (This option is going to be discussed in detail in the next chapter: Creating content types.).
  2. By adding projects containing custom content types and modules to the site configuration.

To create content with Drupal, you first expand the Add content item in your personal menu (often found in the left sidebar when you are logged in). You are then shown a list of available content types, and pick the type you want to create.

noteOne of the advantages of Drupal is that it is very easy for an administrator to extend the content types available, to configure the installation to include or exclude particular content types, to change the name, description and/or “rules” for using a particular content type, and also to grant or refuse a any user role the right to create content of a particular content type. The list of content types below is what the user will see if you run Drupal 7 straight out of the box, enable all core content types, and give the user access to them. If you click on the Add content-link on some Drupal-based website, you will probably see a different list, depending upon how the administrator has set up the site.

This is a list of the core content types that available in the core of Drupal 7. I've added my own notes about how I think they should be used (or not).

Article:
An Article is similar to a Basic page (see next item), except that it is published with an author byline, is automatically promoted to the site's front page, and provides the ability to post comments. It is suitable for publishing articles, blog entries, news items, press releases, site announcements, and similar material. This is one of the two content types that comes pre-enabled if you use the Drupal 7 default installation profile.
Basic page:
A Basic page is for creating and displaying official and static information that rarely changes. It is a basic content container that is intended to be static and to stand alone. By default, a Basic page entry does not display the name of the author/owner, does not allow comments, and is not featured on the site's front page. You must create an explicit link to a Basic page if you want it to be visible. A Basic page is mainly for permanent notices that is made accessible through custom navigation, (e.g. the “About us“ page for the website, or “Privacy policy“). The Article content type is better suited for news and other topical content. This is one of the two content types that comes pre-enabled if you use the Drupal 7 default installation profile.
Blog entry:
A Blog entry is a single article to be posted in an online journal, or blog. It will be featured on the front page by default. An link to a user's recent blog entries is also featured on the user's profile page. Use this content type if a single site is shared by a community of bloggers. If the site is intended for a single blogger, the Article content type is more suitable. To have this content type, enable the core Blog module.
Book page:
In Drupal 7, any node content type can be inserted into a book. This means that you will probably not want to have any content belonging to the Book Page content type. However, if you enable the core Book module, administrators and authors will get access to a set of functions to manage nodes tied together in a hierarchical structure. For a more detailed description about how to use books, see the section about book pages below.
Forum topic:
A Forum topic is the initial post to a new discussion thread within a forum. It is linked to from the appropriate forum. To have this content type, enable the core Forum module.
Poll:
A Poll is a question with a set of possible responses. A poll, once created, automatically provides a simple running count of the number of votes received for each response. By default, a Poll is automatically featured on the site's front page. To have this content type, enable the core Poll module.

Poll

A poll is a question posed to visitors to your site that users are allowed to answer on the site. Polls are great for getting your community of users involved in discussions. Drupal has a simple interface that allows you to create custom polls.

To create a poll, navgate to Add content » Poll, and fill in the fields with “Question” to ask and the choices. You may preset the poll duration for up to a year, or “Unlimited”. The poll may also be manually closed.

pollcreate.png
Create poll.

After a registered user has voted, she sees a tally of the current voting results, such as the one shown in the screenshot below.

pollresult.png
A poll.
“Most recent poll”

The core Poll module only lets each user vote once. This even go for the anonymous user. The contributed Poll Enhancements project enables anonymous users to vote on polls without page cache troubles or IP address restrictions.

tipThere is also a Poll Improved project that uses entities and fields and is supposed to create a poll block. I am unable to figure out how to configure it to make it usable. Caveat emptor.

Using books

In Drupal, it is possible to connect nodes together. Such an interconnected set of pages is called a book. Books are a very useful structuring mechanism in Drupal. They are typically used to organise manuals, projects, cookbooks, and whatever else where the designer needs to maintain a collection of related entries in a hierarchical structure.

To be more precise, a Drupal book is a set of nodes tied together in a hierarchical structure, with a “top”, and “chapters” beneath that. A chapter's pages can be grouped into “sections”, and so on, up to nine levels deep. When nodes are organised into a book, Drupal will automatically create a table of contents and appropriate navigation links between the nodes of a book, providing a simple navigation system for organising and reviewing structured content.

At the bottom at the book outline page, and every page that is part of a book, there is a link to a Printer-friendly version at the bottom of the content area. If the user clicks this link, it will take him or her to a single page containing all the content of that page and any subpages it may have. The resulting document can be styled with a separate print stylesheet stack (extremely minimal in most standard themes), so it is also possible to have material irrelevant for a printed copy, such as navigation stripped out. Clicking this link on the top-level page of a book, will produce a page containing the whole book in one single page, ready to print.

When the content type Book page first appeared in Drupal, it was the only content type that could by tied together. These days, however, any content type can be inserted into a book hierarchy, and will then automatically link to a parent, child and sibling pages. To make an Article-page the top-level page of a book, you just dip into the Book outline section and select <create a new book>. There is no longer much special about a Book page. The only thing that remains is that when you use the link Add child page from within a book, the node created will always be a Book page. These days, you may want to override this and there is a module named Book made simple that lets you do this.

tipSince any node in Drupal can be embedded in a book and then behaves just like a Book page, a the existence of a special Book page content type confuses many users. Hiding the Book page content type by making it inaccessible to users has the undesirable side-effect of making the Add child page-command inaccessible. I have found no simple way around this. On some of my Drupal sites, I hide the Book page content type to most users and only make it available to so-called «super-users» that create a lot of complex content and have received some training in how to create content with Drupal. At other sites, I put some tutorial material (like the text in this section) online and hope the users will read it and understand that they do not need to use the Book page content type to manage books.

See alsoFor more about creating and managing books, please see the article: Book module overview. For a tutorial on books using a FAQ as an example, please see: Maintaining a FAQ using a collaborative book. Both articles are part of the Drupal.org site. For an alternative to using books, take a look at the design notes for Drupal.org documentation. Instead of the book content type, it makes site documentation an organic group using sub-groups (per sub-section of documentation).

Creating content

[TBA]

[about teaser]

<!--break-->

[no spaces before or after break]

Tracking content

Drupal can be set up to create a new revision every time a node is revised. This allows you to track how the node has changed over time on the site.

To enable this feature, go to the default node editing form (administer » structure » content types » bundle » edit » publishing options) and check the box Create a new revision in the node editing form. This will result in a new revision automatically being created every time the node is edited. (Administrators can override this when editing an individual node.)

An useful addition to revison tracking is the Diff module. This module displays the differences between two revisions.

The Tracker module (in core, but disabled by default) displays a site's most recently added or updated content. It also provides user level tracking. When you enable it a new meny entry (Recent content) is added to the navigation menu, and a new tab (Track) is added to each user's profile.

noteThe Tracker module has no administrator interface beyond enabling and disabling. Enabling a predefined view named Tracker allows administrators to customize the tracker view and to add access control to the menu entry. However, unless the Tracker module also is enabled, there will not be user level tracking.

RSS

In Drupal 7, core Node module provides basic RSS publishing for content. An RSS feed is generated at /rss.xml. By default, the RSS feed will contain the ten most recently created pieces of content promoted to the front page. you can add a description, change the number of items displayed and contain the content of the feed by visiting Configuration » Web services » RSS publishing.

If fields attached to content are desired to be attached to the feed, these may be configured on the manage display page for the content type. Navigate to Structure » Content types, and click manage display for the content type you want to configure. Exapand the panel Custom display settings and tick “RSS”. There is now a manage display setting for “RSS”.

Final word

[TBA]


Last update: 2017-09-20 [gh].