Sep

24

Giving your Static Homepage and Blog page different TITLES in Wordpress

Posted in Wordpress

2 Comments

Wordpress is great for simple CMS sites and the All in One SEO Pack (AIOSP) plugin makes controlling the page title, description and keywords easy.

By default however the blog page and static homepage share the same page title. This is a solution for giving the blog page the title ‘blog’ and the static homepage the title of your website.

First go to Settings » all in one seo and untick ‘rewrite titles’:

Untick Rewrite Titles

All in one SEO will now not control the way titles are displayed on your website but will still control the description and keywords on pages.

Next open up your wordpress ‘header.php’ file and replace the current title tags with the following:

<?php if( is_front_page() ) : ?>
<title><?php bloginfo('name'); ?> | <?php bloginfo('description'); ?></title>
<?php elseif( is_home() ) : ?>
<title><?php echo get_the_title(PAGE ID OF YOUR BLOG PAGE) ?> | <?php bloginfo(’name’); ?></title>
<?php else : ?>
<title><?php wp_title(’ | ‘,true,’right’); ?><?php bloginfo(’name’); ?></title>
<?php endif; ?>
<?php wp_head(); ?>

This code uses the  built in wordpress conditional tags to check what the current page is and display the correct page information accordingly. is_home is actually your blog page, not your home page and will not display the correct page name if if a static page has been defined for the blog which is why we have to directly reference the blog page title (usually blog) through the page ID.

The true,’right’ following the else statement is used to move the separator to after the page title so the site title can follow correctly and the final piece of code ‘wp_head’ is what gets the page description and keywords from the All in one SEO Pack.

The final step is to go back to your Wordpress admin, go to Settings » General and set your blog title and blog description then go to Settings » all in one seo and set your homepage description and keywords.

Control over each page/post’s description and keywords is controlled on their individual pages within the wordpress admin.

Hope this helps with your Wordpress CMS sites!

Comments

  • hotels

    November 5, 2008

    It’s useful SEO friendly solution: Thanks the idea ;)

  • [...] like… blog or maybe news. So I started to search a little and found no good solution. This post has a solution, but it’s not optimal. I like to have a template that can be used across [...]

Leave a Comment