Optimize your title tags
May 27, 2008 · Print This Article
There are plugins available to help optimize your title tags, however, editing one line of code can help you avoid an additional plugin. To me it’s worth it – less plugins, better performance.
So let’s do it.
Locate the title tags in your theme’s header.php file. It will look something like this:
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>
Now change it to this:
<title><?php if (is_single() || is_page() || is_archive()) { wp_title('',true); } else { bloginfo('description'); } ?> — <?php bloginfo('name'); ?</title>
The above change will not only optimize your title tags, but it will also generate dynamic titles throughout your blog. Pages, posts, archives, search page, category pages, etc..
Comments
Got something to say?
You must be logged in to post a comment.