Every Old Problem is New Again

My recent redesign and switch to WordPress was started about 6 months ago, and was allowed to languish until a couple weeks ago, when I found the time to finish the project. As a result, I keep running into little bugs/issues that I should have caught before I launched- stuff I thought about 6 months ago, and forgot about until now.

One example is tweaking for search engines. A couple of years ago, I made some tweaks to my Blosxom templates to help search engines better index my site. I added post titles to permalink (single post) pages, to make sure Google, et al, show more than just “jclark.org” above every hit on my site. I also added <meta name='robots' ... /> entries to ensure that category and date archive pages weren’t indexed, only permalinks (and the main index page). Of course, I forgot to add these changes to my WordPress templates, and Google has recently reindexed me, so I’m back to square one.

I updated my header template (header.php) last night to get the post title back onto permalink pages. This was surprisingly easy, as WP offers a function aimed squarely at this purpose:

<title>jclark.org<?php single_post_title(' - ');?></title>

The function single_post_title will only output a value if the current page is a permalink page, optionally inserting a prefix (I use ' - '). This allowed me to update the header template used all across the site, without building my own switching logic. Because the entire html <head> section is in my header template, adding the robot meta directives will require a bit of switching logic; maybe I’ll check to see how single_post_title() is implemented and steal be inspired by that code.

Both comments and pings are currently closed.

One Response to “Every Old Problem is New Again”

  1. Aleksandersen Says:

    If you look at conditional tags for WordPress you could create a great page titles for each kind of page.

    If you surf around at my new blog you will find that I have modified the title tags to a great extent. You could duplicate the effects yourself, or I could send you the code if you like (you got access to my e-mail address from the WordPress comment moderation panel).