Wordpress header.php Meta SEO Tricks

8 replies
  • SEO
  • |
Here are some tips on Meta-Tags within the theme header.php file:
(wp-content/themes/yourthemename/header.php)

Place this in your wordpress themes header.php file, if the page is a single, page, or if its the home page then the robots will index and follow links on it. Otherwise search engines will not index the pages but will still follow the links.

<?php if(is_single() || is_page() || is_home()) { ?>
<meta name="googlebot" content="index,noarchive,follow,noodp" />
<meta name="robots" content="all,index,follow" />
<meta name="msnbot" content="all,index,follow" />
<?php } else { ?>
<meta name="googlebot" content="noindex,noarchive,follow,noodp" />
<meta name="robots" content="noindex,follow" />
<meta name="msnbot" content="noindex,follow" />
<?php }?>

OK here is a great resource with all the info you need to know about meta-tags in wordpress:

http://codex.wordpress.org/Meta_Tags_in_WordPress

Basically you need to do this manually by adding the meta-tag code to your theme's header.php file (wp-content/themes/yourthemename/header.php)

add this code between the <head> ... </head> tags:

<meta name="description" content="This is the description sentence or short paragraph about your website." />
<meta name="keywords" content="your, keywords, here" />


If you want to get fancy, you could use the most common additional meta tags:

<meta name="resource-type" content="document" />
<meta http-equiv="content-type" content="text/html; charset=US-ASCII" />
<meta http-equiv="content-language" content="en-us" />
<meta http-equiv="author" content="Harriet Smith" />
<meta http-equiv="contact" content="harrietsmith@harrietsmith.us" />
<meta name="copyright" content="Copyright (c)2008
Harriet Smith. All Rights Reserved." />


There are however more important things other than meta tags that you should be worried about to really optimize your site with keywords...


To improve your SEO (search engine optimization) There are things you MUST do:

#1: Set your Permalinks to something with your post title in the url. This changes your URL structure from the ugly : yoursite.com/?page_id=34 to something much more search engine friendly, by putting the keywords in your url, like this : yoursite.com/sample-post/

To configure your Permalinks, login to your Wordpress dashboard, click 'Settings' then click 'Permalinks'. Here you can customize however you want your url's to be structured.

For example, to make it like : yoursite.com/sample-post/ click the bottom radio button, Custom Structure and enter this: /%postname%/

(Be careful with this structure if you are planning on creating other folders within your root folder, because if you create a folder as the same name as the post, it will not show your blog post, but will default to the new folder you created)

I personally use and recommend using the date before my post titles, here is the way to do that:

/%year%/%monthnum%/%day%/%postname%/

which will produce: yoursite.com/2008/10/28/sample-post/



#2: I highly suggest you install The All In One SEO Pack

Automatic Search Engine Optimization (SEO) out of the box for your wordpress blog ... This plugin is streamlined for some best practices for Wordpress SEO. While it gives you many options the defaults reflect the settings I recommend using.


Anyone else have any other tips or tricks?

- Jared
#headerphp #meta #seo #trick #wordpress
  • Profile picture of the author kas10900
    The all in one seo pack is great, I sometimes forget to put the tags in when I'm posting though so I have to go back in and edit.
    {{ DiscussionBoard.errors[210433].message }}
  • Profile picture of the author hyp959
    yes, The all in one seo pack is enough for seo ,I think.
    {{ DiscussionBoard.errors[210613].message }}
  • Profile picture of the author Netcel
    Looks complex, but could be useful. Thanks for sharing
    Signature

    {{ DiscussionBoard.errors[762349].message }}
  • Profile picture of the author promo_guy
    I sometimes use the platinum-seo-pack which I don't hear many talking about but I've read it's supposedly better than all-in-one but either should do the trick. Don't forget adding your sitemap plugins and adding your sitemaps to G/Y/MSN
    {{ DiscussionBoard.errors[762705].message }}
  • Profile picture of the author praxis
    Yes, the all-in-one seo pack takes care of your meta keyword and meta descrip issue. But agreed about the permalinks...

    Another tip is to make sure keywords are in your title tag, and h1 (sometimes h2) tags. Internal linking with keywords anchor text also helps.

    thanks for your help and the wordpress resource
    {{ DiscussionBoard.errors[2176187].message }}
  • Profile picture of the author Jack Sprat
    Originally Posted by Jared Alberghini View Post

    For example, to make it like : yoursite.com/sample-post/ click the bottom radio button, Custom Structure and enter this: /%postname%/

    (Be careful with this structure if you are planning on creating other folders within your root folder, because if you create a folder as the same name as the post, it will not show your blog post, but will default to the new folder you created)
    Or you could make your Custom Structure -->

    /%postname%.html


    This way there will be no conflict between your post name and any folders that you create that have the same name as your post.
    {{ DiscussionBoard.errors[2179597].message }}
  • Profile picture of the author nettech
    I prefer to use /%postname%.html and it works great for me!
    Signature

    Thanks
    Zaheer

    {{ DiscussionBoard.errors[2179613].message }}

Trending Topics