Drupal Theme: 
UQ Base Template
Learning Objectives: 

In this session, you will learn how to install a new content type called "Article" and how to use it to build news on your website. You will learn how to create articles and display them in two ways; as a full listing on your news page and as a short list on your homepage.

Unit 3.1: Central things manager

In order to create news articles, we need to enable the content type “Article”:

  1. Go to Central Things Manager in the admin menu.
  2. Click on “Install Things” tab on the right.
  3. Check the “Article” box and click “Install Things” button at the bottom. This may take a minute or two to complete.

Unit 3.2: Create articles

Go to Content > Add Content, you can now add a content of type “Article” for your news items.

  1. Go Content > Add Content > Article.
  2. Give your article the title "News article #1", a short summary, an image and body text. NOTE: Training resourses are available on the training resources page of the Drupal website.
  3. Note, the published date is quite important as it is likely to be displayed in News listings. Have a go and change the published date - the date is found in the "publishing options".
  4. Create another 4 news articles. Name these articles "News article #2", "News article #3", "News article #4", "News article #5"
  5. Make one of your articles feature on the homepage banner.

Unit 3.3: Full news listing

We now can create a news page on the website that displays a full list of all the articles we have. There already exists a block that will display all the articles on our site, we will just need to display it in the right place – on our “News” page.

  1. Go to the admin menu Structure > Blocks
  2. Look for the “View: List of Articles: Articles: Title, Summary, Image” (towards the bottom of the listing) and select configure.
  3. Block title can be “<none>”
  4. Region settings will set where in the website layout we want the block to appear. There is a help guide which displays all the available regions. Select "Content Primary".
  5. Visibility settings will determine what pages/users we want this block to appear. Let’s limit this block to only appear on the “News” page.
    Select the option “Only the listed pages”.
    Enter in the text box below the URL of your news page eg. node/15
  6. Save block.

  1. Navigate to your news page, the list of articles should appear on your page.

Unit 3.4: Display latest news

Let’s now display the 3 most recent news articles on the homepage.

  1. Navigate to the homepage.
  2. In a region > Add Element > View
  3. Select "(List of Articles) Articles: Title, Image"
  4. Open Custom View Options
  5. In Custom header, type "Latest news" and set it to H3.
  6. In Custom footer, type "See more news" and link it to your news page.
  7. Set the max number of items to 3.
  8. Click Preview. Notice in the preview that there's a pager at the bottom of the listing. 
  9. Set Pager type to "Fixed number of items (no pager)".
  10. Click Preview. The pager should be gone.
  11. Add view. You should see your new block appearing like below:

    NEXT: Final steps