How to Remove the "Username's Blog" Link from Your Drupal Blog
by Christopher Heng, thesitewizard.comOne of the benefits of using Drupal is that it supports multiple sites on a single installation. Unfortunately, this ability also creates annoyances for people who only want to use Drupal for a single blog. One such annoyance is that the Drupal blog module creates a "username's blog" link at the bottom of every post, on the main page, the post article page as well as every category page. This article briefly describes how you can remove the "username's blog" caption from your blog post.
Why Remove The "Username's Blog" Link?
Visitors who write to me at thesitewizard.com asking about how they can remove the "username's blog" link usually want to do it for one or more of the following reasons:
Aesthetic reasons
Some of them find the link inappropriate in their theme. Others dislike having their blog described with their cryptic user name when they have taken the trouble to give a proper name / title to the blog.
Duplicate Content
A few users, after reading my article on duplicate content issues and its related search engine complications, are worried that since their site only has a single blog, the "username's blog" link points to a page that is identical with their main page.
Steps to Getting Rid of the Username's Blog Link
If you were to try to search through Drupal's theme / template files, you will find that you cannot cleanly remove the code that produces this specific link by modifying those files. Removing the line that prints the $links array also removes other links that you may want. This applies to both Drupal 5 and 6.
To surgically remove this link, and only this link, you will need to modify a file in the core Drupal installation.
Go to the modules/blog folder in your Drupal files.
Open the file blog.module in an ASCII text editor. Do not use a wordprocessor.
Search for the block of lines beginning with "blog_link" in the file. It should look something like the following:
/** * Implementation of hook_link(). */ function blog_link($type, $node = NULL, $teaser = FALSE) { $links = array(); if ($type == 'node' && $node->type == 'blog') { if (arg(0) != 'blog' || arg(1) != $node->uid) { $links['blog_usernames_blog'] = array( 'title' => t("@username's blog", array('@username' => $node->name)), 'href' => "blog/$node->uid", 'attributes' => array('title' => t("Read @username's latest blog entries.", array('@username' => $node->name))) ); } } return $links; }(For those familiar with PHP programming, basically, just search for the blog_link() function.)
Comment out the heart of the function as follows:
/** * Implementation of hook_link(). */ function blog_link($type, $node = NULL, $teaser = FALSE) { $links = array(); /* if ($type == 'node' && $node->type == 'blog') { if (arg(0) != 'blog' || arg(1) != $node->uid) { $links['blog_usernames_blog'] = array( 'title' => t("@username's blog", array('@username' => $node->name)), 'href' => "blog/$node->uid", 'attributes' => array('title' => t("Read @username's latest blog entries.", array('@username' => $node->name))) ); } } */ return $links; }That is, put a "/*" (without the quotes) after the line "$links = array();" and a "*/" (without the quotes) on the line before "return $links;".
Since you are modifying a core Drupal module, every time you update Drupal, you will need to remember to add your modifications to the "modules/blog/blog.module" file.
That's it. Reload your blog and you will find that the "username's blog" link is now gone.
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/.
If you find this article useful, please consider making a donation.
thesitewizard™ News Feed (RSS Site Feed)

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 our 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
- Things to Look Out For When Designing a New Theme or Template for Your Blog
- 6 Things to Note Before Changing Your Site Design
- How to Create a Search Engine Friendly Website
- How to Upgrade WordPress Painlessly and Quickly: Shorter, Faster Way to Upgrade WordPress
- The Fine Print in Web Hosting: Resource Usage Limits
- How to Register Your Own Domain Name
- Which Web Host Do You Recommend? (FAQ)
- How to Make Money From Your Website or Blog
New Pages
- How to Create and Use Cookies in PHP
- How to Insert Google AdSense Advertisements into Your Blogger Blog
- How to Design a Two Column Layout for Your Website Using CSS
- Is It Legal to Use Any Piece of Music, Image, or Article for my Website? And Other Questions on Copyright Relevant to Webmasters
- Why Do the Pictures on My Web Page Not Show Up in Nvu / KompoZer? Troubleshooting the Broken Images on Your Page.
- Should I Have a Multi-Column Newspaper Layout for My Website? More Tips on Usability
- Should I Use a Temporary Domain Name Till My Preferred Domain Becomes Available?
- Should You Use Cloaked Domain Redirection to Point to Your Website?
- Why Is My Site Not Ranking in the Search Engines?
- What Sort of Website Should I Create In Order to Earn Money?
Popular Pages
- How to Start / Create Your Own Website: The Beginner's A-Z Guide
- Tips on Choosing a Good Domain Name
- How to Create a Search Engine Friendly Website
- Dreamweaver Tutorial: How to Create a Website with Dreamweaver CS3
- How to Design and Publish Your Website with Nvu (free WYSIWYG web editor)
How to Link to This Page
It will appear on your page as:
How to Remove the "Username's Blog" Link from Your Drupal Blog
thesitewizard™, thefreecountry™ and HowToHaven™ are trademarks of Christopher Heng.
Last updated: 19 February 2008.