Description and Keywords in WordPress

In order for people to find a website they need some clues as to what the site or page is about. One way to do that is by adding a description and keywords to the site. Since I used to hand code my web pages it was easy enough to add a couple of lines of code to the file in the form of Meta tags. With WordPress there is little coding involved. Most changes are made using plugins or widgets. Occasionally coding can be done to avoid resorting to those tools.

I recently researched how to add this type of information to this website. It involved adding the following code to the file header.php. When doing so WordPress warns you that your modifying the code of the site so be very careful:

<title><?php bloginfo(‘name’); ?><?php wp_title(); ?></title>
<meta name=”description” content=”<?php if (is_single() ) {
single_post_title(”, true);
} else {
bloginfo(‘name’); echo ” – “; bloginfo(‘description’);
}  ?>” />
<meta description=”Bruce’s website with information about bike trips, artwork, and general bike information.”>
<meta keywords=”bicycle, drawing, charcoal, artwork, bike, bike tours, bike trips”>
For individual blog posts, tags can be used to identify important keywords used.