How to Set Up a Blog with Drupal

Configure Drupal for a Search-Engine Friendly Blog


How to Set Up a Blog with Drupal

by Christopher Heng, thesitewizard.com

This article deals with how you can customize Drupal so that it can be used for a blog. As a side effect, the blog set up using this configuration guide will also have some search engine friendly features.

Requirements

I will assume in this tutorial that you have already installed Drupal onto your web server. If this is not true, you can find a tutorial on how to do this in the article How to Setup the Drupal Content Management System for Your Website or Blog at http://www.thesitewizard.com/gettingstarted/how-to-setup-drupal.shtml

This how-to guide also assumes that you are able to log into Drupal as the "first user" or administrator. This account is the most powerful account in a Drupal system, allowing you to configure the default settings for the Drupal installation for all users. This will be the case if you have followed my first tutorial to install Drupal.

Steps to Customizing Drupal for Blogging

  1. Download Modules

    Get the following modules from the respective Drupal module pages.

    1. Pathauto Module

      We will use Pathauto module to automatically create nice URLs for our blog posts. Make sure you download using the correct link. For Drupal 5.x users, click the "Download" link for the line beginning "5.x" in the Releases section.

    2. Token Module

      The Token module is required by the Pathauto module, so you'll need to get it too. To download it, click the "Download" link in the line beginning "5.x" in the Releases section.

  2. Unpack the Modules

    Go to the Drupal folder on your own computer and open the "sites" subfolder. In the "sites" folder, you should see two subfolders, "all" and "default". Open the "all" folder.

    Create a folder called "modules" here. Open the "modules" folder.

    Unpack the Token and Pathauto into this folder using your archiver. If you don't have an archiver that can recognize tar.gz archives, get one from the Free File Archivers and File Compression Utilities page.

    When you have finished unpacking, you should be able to see two new folders in "modules" - the "token" and "pathauto" folders.

  3. Upload the Modules

    Upload the contents of the entire "sites" folder to your website.

  4. Enable the Blog, Path, Token and Pathauto Modules

    Log into your Drupal account as the first user or administrator (that is, not an ordinary user account) and go to the "Administer" screen. If you have forgotten how to get there, look at the left side panel of your browser window. You should be able to see an "Administer" link. Click on it.

    In your "Administer" screen, look for the "Modules" link in the "Site building" section. In future, I shall refer to this chain of getting to a particular page in Drupal as

    Administer | Site building | Modules

    On the Modules page, you should be able to see the list of modules that have been enabled and installed for your website. Put a check next to the following modules:

    • Blog
    • Path
    • Pathauto
    • Token

    Click the "Save configuration" button at the bottom of the screen.

  5. Enable Clean URLs

    By default, your blog posts (and other pages created using Drupal) will have URLs (web addresses) that look like "www.example.com/?q=node/12". As mentioned in my article on How to Make Your WordPress Blog Search-Engine-Friendly, URLs like these are not as people friendly or search engine friendly as those that have the title of your post in them. "Clean URLs" is the facility in Drupal that allows you to have a more friendly URL.

    Go to "Administer | Site configuration | Clean URLs".

    At this point, you cannot simply click the "Enabled" radio button to enable "Clean URLs". You need to check to see if your web server supports the use of this feature. To do that, find the link "Run the Clean URL test" in the paragraph under the radio buttons and click it. If all goes well, you should be returned to the "Clean URLs" page, with the radio buttons now clickable. The web address of the page you are on will have changed as well: it should now be something like www.example.com/admin/settings/clean-urls.

    Select the "Enabled" radio button and click "Save configuration".

  6. Configure Pathauto

    Although you have enabled "Clean URLs", and the web addresses of your Drupal administration pages have changed to use more people-friendly URLs, your blog posts and other article pages will not automatically be assigned friendly URLs. To configure Drupal to do this, you will need to set the defaults for the Pathauto module.

    Go to "Administer | Site configuration | Pathauto".

    1. Change the "Update action"

      In the Pathauto configuration page, click the "General settings" link to expand the section and locate the part that begins with the heading "Update action".

      By default, when you post a blog article with the title "I Love Drupal", Pathauto will create a URL like "i-love-drupal". This is good, since it's the reason why we installed Pathauto in the first place.

      The problem comes, however, when you edit an existing blog entry and change the title. Pathauto will replace the existing URL with the new URL. The default settings means that the old URL will no longer function. If you have links pointing to the old entries, those links will suddenly lead to 404 pages (that is "File Not Found" pages).

      I personally find this undesirable, so I prefer to set the "Update action" to "Do nothing. Leave the old alias intact". The alternative is to set it to "Create a new alias. Leave the existing alias functioning". This other option has the disadvantage in that you may run into duplicate content issues, where the same content can be accessed under two different URLs. See the article How to Create a Search Engine Friendly Website for more information about why this is undesirable.

      If you changed anything, click the "Save configuration" button before proceeding.

    2. Blog Path Settings

      Expand the "Blog path settings". This section gives the URL to your blog's main page. Drupal supports blogs by multiple authors, each of whom have their own logins, and each of whom can only control their own blog. By default, Pathauto creates a blog URL of the form www.example.com/blogs/username, where username is the login username for the Drupal account. You can change this default here if the default is not acceptable to you. The description of how to set the field can be found in the paragraph below the setting. You probably don't have to do anything unless you have very specific requirements.

      Check the box "Bulk generate aliases for blogs that are not aliased".

      You may also want to enable the "Create feed aliases" checkbox so that Pathauto also create user-friendly URLs for your news feeds.

      Save your configuration before continuing by clicking the "Save configuration" button.

    3. Node Path Settings

      The "Node path settings" controls the URLs of your individual posts. By default, your posts will look like "www.example.com/content/your-title-here". If you prefer your blog posts to have a different URL, enter the pattern into the "Pattern for all Blog entry paths". Since you are using Drupal as a blog, you can ignore the "Page" and "Story" path options.

      In general, the default is probably acceptable unless you have some particular requirement.

    4. Category Path Settings

      When you make a post, and you "tag" a post as belonging to a particular category, a category page for that post is also created. The URLs for those category pages can also be configured under the "Category Path Settings".

    5. Others

      You can also configure other aspects of Pathauto, such as the replacement of punctuation characters in the URLs ("Punctuation settings") and the URLs for the user pages ("User path settings"). If you don't know what you're doing, I recommend that you leave the Punctuation Settings alone.

  7. Configure Site Information

    Go to "Administer | Site configuration | Site information".

    1. Name

      Unless you plan on naming your blog or site "Drupal", you should change the name to that of your website.

    2. E-mail address

      When a visitor signs up for an account on your site, he/she will be sent a registration email message. The email address entered here will be used as the "From" address in such messages. The Drupal installation recommends that you enter a valid email address here. If you are worried that this address might become a spam magnet, you can always create a valid email address specifically for your Drupal installation, and black-hole all messages sent to this address. Most commercial web hosts allow you to create such black hole addresses easily from their control panel.

      If you do use a black hole (but otherwise valid) email address, you should probably name the email address something obvious like "no-reply@example.com" (where example.com is your domain name). Otherwise some of your users might try to contact you through that address for a legitimate purpose. Since the address is valid, they will not receive a bounce message. Unfortunately, you will not receive the message either.

    3. Slogan / Mission

      If you have a slogan for your site, you can enter it in the "Slogan" field. Some themes will display the slogan. Do likewise for the "Mission" field. Note: it is okay to leave those fields empty if your blog has neither a slogan nor a mission statement.

    4. Footer message

      If you wish to display a footer on every page, enter it in the "Footer message" box. Footers are particularly useful if you want to display a copyright message on your pages. If you want the copyright symbol, that is ©, enter "©" (without the quotes) instead. It will display correctly as the copyright symbol on your real pages.

    5. Default front page

      Leave the "Default front page" field at its default setting.

      After you click the "Save configuration" button, you should be able to see your changes immediately reflected in your blog. The name of the site at the top of the page will have changed, and if you added a footer, you should be able to see it at the bottom of your page.

  8. Setting Up Cron

    Go to "Administer | Logs | Status report". Click the "run cron manually" link. (It's in the "Cron maintenance tasks" block in the green section.)

    One of the hurdles in using Drupal for newcomers is the need to set a cron task for Drupal. Unlike a number of other (simpler-to-use) blogging software, including Expression Engine and WordPress, Drupal requires that you schedule a program to run on your website at regular intervals. This program will do certain maintenance tasks for your site, such as cleaning up your logs.

    The program that needs to be run regularly is the Drupal cron.php file. It needs to be invoked using a browser. If your site lives on a Linux, FreeBSD or Unix-type server (as most sites do), set up a cron job to run a command like:

    /usr/bin/wget -O - -q http://www.example.com/cron.php

    The "wget" program is a command line browser (in a manner of speaking) that can be invoked to load your website's cron.php file. You will of course have to change the "www.example.com" to your own domain. The options "-O -" means to send all output to the screen (instead of saving it to a file) while "-q" means to do the job quietly.

    Details on how to set up a scheduled task on a web server can be found in the article How to Create a Cron Job (Scheduled Task) for Your Website or Blog.

    If your web host does not permit "cron" tasks, there are at least two other alternatives:

    1. Use the Poor Man's Cron Module

      Install the Poor Man's Cron Module which checks to see if the last time cron ran was more than an hour ago (or some other period which you can set). If so, it executes the cron tasks. The module can be installed by copying the files the same way you did for the Token and Pathauto modules earlier, and enabling it in "Administer | Site building | modules".

      The Poor Man's Cron module probably adds some overhead to your site's resource usage (as do most modules), since it has to perform these checks every time a page on your site is loaded. (Note: I have never used this module before, so I can't help you much here.)

    2. Run Cron Manually

      Another way is to simply run cron manually every time you visit your website. To do this, simply visit www.example.com/cron.php in your web browser, where www.example.com is replaced by your domain name. Don't be alarmed by the blank page when you load that page - that's normal - it was designed to be that way since that page is supposed to be loaded in the background by a cron task.

  9. Other Settings

    There are a number of other customizations that you can make to your blog. For example, you can change the appearance and colours of your blog in "Administer | Site building | Themes". The date and time settings can be found in the "Administer | Date and time" link. You can also set the menu items that you want to appear in your side panel in "Administer | Site building | Menus" and control their placement in "Administer | Site building | Blocks".

    However, for the most part the most crucial customizations for your blog is done, and you should be able to start posting to your blog.

Next Chapter

In the next tutorial, I will deal with the troublesome task of creating a custom Drupal theme (which controls the appearance of your blog).

(Note that you don't have to wait to complete the next chapter before posting to your blog. The beauty of using blogging and content management software is that you can change your theme in mid-stream any time, and all the previous posts you have previously made will automatically use the new theme.)

Copyright © 2008 by Christopher Heng. All rights reserved.
Get more free tips and articles like this, on web design, promotion, revenue and scripting, from http://www.thesitewizard.com/.

thesitewizard™ News Feed (RSS Site Feed)  Subscribe to thesitewizard.com newsfeed

Do you find this article useful? You can learn of new articles and scripts that are published on thesitewizard.com by subscribing to the RSS feed. Simply point your RSS feed reader or a browser that supports RSS feeds at http://www.thesitewizard.com/thesitewizard.xml. You can read more about how to subscribe to RSS site feeds from my RSS FAQ.

Please Do Not Reprint This Article

This article is copyrighted. Please do not reproduce this article in whole or part, in any form, without obtaining my written permission.

Related Pages

New Articles

Popular Articles

How to Link to This Page

It will appear on your page as:

How to Set Up a Blog with Drupal





Home
Donate
Contact Us
Link to Us
Topics
Site Map

Getting Started
Web Design
Search Engines
Revenue Making
Domains
Web Hosting
Blogging
JavaScripts
PHP
Perl / CGI
HTML
CSS
.htaccess / Apache
Newsletters
General
Seasonal
Reviews
FAQs
Wizards

 

 
Free webmasters and programmers resources, scripts and tutorials
 
HowtoHaven.com: Free How-To Guides
 
Site Design Tips at thesitewizard.com
Find this site useful?
Please link to us.