Creating Front-Page Articles
When you first install Drupal, the front page is blank! I don't know about you, but I hate blank Web pages. The first thing I always do when I make a new Drupal site is add content to the home page of my site. Even if you don't want to have a "blog," you can still post newsworthy information to your home page on a regular basis using the steps outlined in this section. Depending on the type of site you have, this may include promotional information about upcoming events or summaries of things that have already passed.
To create a new front-page story, you will use the content type Article. This content type has the following features.
- Summary posted to the front page of the Web site
- Comments enabled
- Option to upload an image to be displayed with the article
- User name of the article author as well as the time it was originally published
- Tags enabled, allowing you to categorize articles
Figure 4.6 The form used to create a new article
Figure 4.7 A node created from the content type Article
Creating Your First Article
You need to be aware of four areas on the article editing screen.
- Title and Body. This is the content of your article.
- Image. This is an optional field used to add an image to your article.
- Tags. This is an optional field used to add keywords to your article. These keywords can be used to categorize similar articles.
- Additional configuration settings. For now you can ignore these settings. They will be covered later.
To create an article, complete the following steps.
- From the shortcut menu, click the link "Add content." An overlay will appear prompting you to choose between Article and Basic page.
- Click Article. An editing form will appear as in the previously displayed Figure 4.6.
- Enter a title and body content.
- Enter keywords about your article in the section labeled Tags. This step is optional.
- Upload an image. This step is optional. Click the button labeled Browse. Select the image you want to upload from your computer in the pop-up screen. Click Upload. A new field will appear: "Alternate text." Enter a short description of your image. This text is used by search engines and adaptive technology. The image will be automatically resized but needs to be smaller in megabytes than the limit listed. Figure 4.8 shows the editing screen after having successfully uploaded an image.
Figure 4.8 A successfully uploaded image showing a thumbnail and complete alternate text
- For your first article, you do not need to change any defaults listed at the bottom of the screen. You can scroll past this section.
- Scroll to the bottom and click Save.
Your article will be added automatically to the front page of the Web site. You will be redirected to the full-page view of your new article. Beside the title of the new page are two links: View and Edit. To alter the text of your article, click the Edit link. Web site visitors will not see the link to edit your page.
That's all there is to creating a new article on your Web site. Check the front page to see your new content displayed. You can get to the home page of your Web site by clicking the house icon in the top-left corner of the administrative toolbar.
Each time you add a new article to your Web site, it will be added to the top of the list of articles on the front page. This is because the node has been assigned a property of "Promoted to front page." You can change this setting per-node using the following steps.
- Edit the node you want to change.
- Scroll to the bottom of the edit screen and click "Publishing options."
- Select or deselect the check box for "Promoted to front page," depending on what you want to do.
- Scroll to the bottom of the page and click Save.
Your node will now be removed from, or added to, the front page, depending on the settings you used.
When you have more than 10 articles, a pager will appear at the bottom of the home page. A pager is a collection of links that breaks a very long list into smaller sections. For example, a list of 100 items with 10 items per page would yield 10 pages of results. Pagers typically have links for "next" and "previous" pages as well. Figure 4.9 shows a pager.
Figure 4.9 A pager allows Web site visitors to navigate through a very long list of items.
If you would like more, or fewer, items to appear on the home page of your Web site, you must complete the following steps.
- On the administrative toolbar, click Configuration.
- Click "Site information."
- Scroll down to the section "Number of posts on front page." Adjust this number to suit your needs.
- Scroll to the bottom and click "Save configuration."
This number will also be used by the pager to divide the remaining front-page items into pages. In other words, if you change this number to 1, the pager will display only one item per page.