Interesting Site Note: Taglines

A few people have mentioned that my website's tagline changes from time to time, and have noted the wit they contain. (One even thought it was a running story, which isn't a bad idea actually, but few taglines are related to each other.) This site's tagline, technically the "slogan" in Drupal-speak, is often a turn of phrase from a rap song, but sometimes something that resonated with me from a text, like a book or article. A few months ago I set it up so that instead of manually changing the tagline through Administer » Site configuration » Site information, I could create a page that would automatically set the tagline's explanation. The advantages of that are many: I can create an RSS feed for tagline updates, tag each tagline, and refer to each explanation with a URL instead of having to go through it each time someone asked. And people could comment on each tagline.

How I Did It: CCK, Views, and Some Elbow Grease

The taglines, old and new, are available at with an RSS feed at To achieve that, I created a content type called "Taglines" with a description field using the CCK set of modules. Then I created a view using the Views set of modules, with an RSS feed argument. The hard part was getting it to automatically change the Drupal site slogan when I saved it, but the code that does it can be seen in the Fenchurch omnibus module I wrote. The relevant code is as follows:

* The function takes the title of the most recently posted Tagline CCK content type.
* Replace 'content_tagline' with the content type you are using to update your site's slogan with.
function fenchurch_nodeapi(&$node, $op) {
$content_type = 'content_tagline';
switch ($op) {
case 'submit':
case 'insert':
if ($node-?>status == 1) {
$result = db_query("SELECT nid FROM node WHERE type = '%s' ORDER BY created DESC LIMIT 1", $content_type);
$nid = db_result($result);
if ($nid == $node->nid) variable_set('site_slogan', $node->title);

(In your module you would have to change the function name to match the module name. For example, if the module is called arthur.module, you'd name the function arthur_nodeapi. I wrote it with a switch statement so that I can add functionality to it without having to restructure.)

Since the tagline appears on each page, it would need an explanation on each page. For that, I have the following code in the page.tpl.php file my theme (this is simplified from the code that currently runs) that creates an unobtrusive question mark people can click on to find out more, with instant gratification for those who hover their mouse over it.

$tagline_explanation = strip_tags(db_result(db_query("SELECT field_description_value FROM {content_field_description} WHERE nid = %d", $tagline_nid)));
print '[' . l("?", 'node/' . $tagline_nid, array('title' => $tagline_explanation)) . ']';

Briefly, the code above retrieves the ID of latest published tagline, then retrieves the data from it, strips out the HTML from the description, and wraps it in a link. It could use a little unpacking, since a lot happens on each line, and there's some magic using Content Template, if you understand PHP, you'll get the idea.

Search Engine Benefits

The site slogan, as it's called in Drupal, goes in the RSS feed added on to the title of the website, so anybody syndicating the site will likely have that in the link title. That often means that you will quickly rank highly for whatever you've set as your tagline, as I have for most of my site's taglines. It looks like I drop quite a bit in search engines for old taglines as soon as I change it, but at least with each tagline as a 'page' as far as their concerned, I'll still have a position in the search engines for my previous taglines. But more important for me is to have a record of when and why I changed what appears at the very top of my blog.