Better SEO Titles in WordPress 2.5

A bane of Word­Press devel­op­ment for a long time were the awful titles gen­er­ated for blog posts. When I speak of this I’m talk­ing about the order of the blog title and the post title are put together. An exam­ple of this can be found below.

Bad Title

And this exam­ple is bet­ter than other’s I’ve seen. On some sites where the blog/post title is long then the post title is trun­cated! This is unac­cept­able when search engines give so much weight to the con­tent of your post titles.

For a long time I cir­cum­vented this behav­ior by using the Opti­mal Title plu­gin. It worked fine, but it was yet another plu­gin for some­thing that should’ve been inside the core. So I opened ticket #4407 to inte­grate the plu­gin archi­tec­ture into the core. I cre­ated a patch, and it became change­set 6,538! In short, I added a para­me­ter into wp_title() that sets the loca­tion of the sep­a­ra­tor. By default, it goes to the left, but you can move it to the right by spec­i­fy­ing it. If you don’t spec­ify any­thing it defaults to the legacy behav­ior of going to the left.

This is the code you can now use to gen­er­ate sexy SEO titles:

<?php wp_title('&raquo;',true,'right'); ?> <?php bloginfo('name'); ?>

This will print: Post/Page Title » Blog Name. By ensur­ing that you spec­ify mean­ing­ful titles for your post­ings then you can ensure that your find­abil­ity will increase.  The offi­cial doc­u­men­ta­tion on this func­tion has also been updated to include this change.

4 Comments

  1. Good job. That has to be a great feel­ing, get­ting one of your changes added to the core like that. Keep up the good work

    Josh Highland on 03.31.08
  2. @Josh: Yes it does feel good to give back to an appli­ca­tion that has given a bunch to me.

    Chris Poteet on 03.31.08
  3. Nicely done, I agree titles are a HUGE asset for SEO. Keep up the good work man.

    Justin Kohnen on 04.10.08
  4. @Justin: Thanks!

    Chris Poteet on 04.12.08

Got Something to Say?

(Required)
(Required)