The 'easy' way to add the description meta tag to WordPress posts

According to some people, the keywords meta tag has more relevancy/use than the description meta tag. Unfortunately, this is dead wrong. As I've been able to prove (for myself, at least) this last month, the meta description is quite alive and well. Why people think it's not only dead, but surpassed by the meta keywords (!!!), I'll never understand.

(And, by the way, these were August '05, January '06 articles/posts.)

After looking for a good plug-in, I decided to work on something that was a) easier and b) easier. To that end, I present the following code. This code uses some hard-coded descriptions for the home page, archive/category pages, and the 404 page. For individual posts, it uses the post's "Optional Excerpt".

Note that the WordPress plugin Tags in the Head came the closest to what I was looking for, but was undesireable since it a) required installation of just one more plugin, and b) required another plugin to function. Also, it's focus is on keywords, which, again, I find to be near useless; they are merely more characters that must be read by bots, but which present no real gain.

<?php
if (is_single()){
 if (have_posts()) {
 echo "<meta name=\"description\" content=\"".htmlentities(get_the_excerpt())."\" />";
 }
} else if (is_home()) {
 echo "<meta name=\"description\" content=\"";
 bloginfo('description');
 echo "\" />";
} else if (is_archive()) {
 echo "<meta name=\"description\" content=\"Posts on StrivingLife.net for a specific category or time frame.\" />";
} else if (is_404()) {
 echo "<meta name=\"description\" content=\"The content you have requested is not available at this address.\" />";
} else {
 echo "<meta name=\"description\" content=\"".htmlentities(get_the_excerpt())."\" />";
}
?>

This should be put into the header.php file for your current theme(s), after the line:

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />

Note that the home page description comes from the blog's description. Also note that an echo call does not proceed that line. Unfortunately, the bloginfo() function contains an echo statement. Durr. This description, as well as individual post descriptions, should be around 150 characters.

Comments welcome and appreciated.