Drupal 6 Blog module fix title issue

By shane
Tue, 2011-08-16 22:01

Share with Others

Many people will instinctively enable the blog module when they are trying to build a blog using Drupal 6. It turns out that using the blog module is not necessarily the best option for building a simple, single user blog. Building a single user blog is easier to build using a simple content type that just flows into Drupal's default front page, or by using the views module to build a blog listings page.

The Drupal 6 blog module is geared toward building a multi-user blog site. However, if you like many others have already started using the Drupal 6 blog module to create your single user blog, do not worry, you can still make it work.

You will most likely want to point either your front page, or your websites "Blog" link to the "/blog" page (ex: example.com/blog). You can easily modify the content type as necessary to make your blog work as a single user blog, that can then easily be expanded to a multi-user blog if necessary. However, one annoying problem is your new blog page has a title of "Blogs". Here is a simple fix to add to your template.php file in your theme to force it to say "Blog" instead of "Blogs" (replace MYTHEME with the name of your theme).

function MYTHEME_preprocess_page(&$vars) {
  $vars['original_title'] = $vars['title'];
  $arg0 = arg(0);
  if ($vars['title'] == 'Blogs' && $arg0 == 'blog') {
    $vars['title'] = 'Blog';
    $vars['head_title'] = 'Blog ' . substr($vars['head_title'], stripos($vars['head_title'], '|'));

I know it is not the prettiest looking code in the world, however if you are already in the process of building your blog site and want to use the Drupal 6 blog module, it will at least get the job done.