Wordpress header.php Meta SEO Tricks

by 8 replies
16
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:

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/



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
#search engine optimization #headerphp #meta #seo #trick #wordpress
  • 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.
  • yes, The all in one seo pack is enough for seo ,I think.
  • Looks complex, but could be useful. Thanks for sharing
    • [1] reply
    • I don't think you need the header tricks if using the allinone seo pack?
  • 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
  • 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
  • Or you could make your Custom Structure -->

    /%postname%


    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.
  • I prefer to use /%postname%.html and it works great for me!

Next Topics on Trending Feed