This is a tutorial on how you can implement the most important onsite SEO tweaks to your WordPress blog without ever using a plugin. While plug-in is useful for making things easy and direct, it comes with serious drawbacks which are as follows:
1.) For high traffic websites, SEO related plugins consume a lot of resources in your server. It is because they are often executed at runtime or anytime you create a cache of your blog. This can slow down your blog. Remember that fast website loading is important for Google rankings.
2.) Plugins can become security loopholes in your blog and there are a lot of hacking exploits because of vulnerable plugins.
WordPress is already one of the most SEO friendly website publishing/blogging or CMS software.
It does not anymore need sophisticated and resource intensive SEO plug-ins to make it more SEO friendly. All it takes are these two simple tweaks to your template files and you are done. To get out the most of this tutorial; it is important to know just a little PHP programming to understand how the codes work.
IMPORTANT: Always make sure to provide a backup of your template files before editing anything. Then to implement the code suggestions in this tutorial:
1.) It is highly recommended to test the code in a local server first before deploying it live. You can do this by running your website in a local server such as XAMPP.
2.) Make sure that all SEO plugins are disabled/removed before implementing the code.
Setting Title Tag for your WordPress blog
Title tag is one the most important onsite SEO factor. In WordPress; title tag are edited in header.php of your active theme files. To make your title tag SEO friendly simply replace your existing title tag code with the one below:
<?php
$definehometitletag='Your homepage title tag';
$definenotfoundpage='Page not found';
if ((is_front_page()) && (is_paged())) {
echo ‘<title>Page’. $paged.’: ‘;
echo $definehometitletag;
echo “</title>”;
}
elseif (is_paged()) {
echo ‘<title>Page’. $paged.’:’;
wp_title(”,TRUE,’right’);
echo “</title>”;
}
elseif (is_front_page()) {
echo “<title>$definehometitletag</title>”;
}
elseif (is_single()) {
echo “<title>”;
wp_title(”,TRUE,’right’);
echo “</title>”;
}
elseif (is_page()) {
echo “<title>”;
wp_title(”,TRUE,’right’);
echo “</title>”;
}
elseif (is_archive()) {
echo “<title>”;
wp_title(”,TRUE,’right’);
echo “</title>”;
}
elseif (is_404()) {
echo “<title>$definenotfoundpage</title>”;
}
else {
echo “<title>”;
bloginfo(‘name’);
echo “</title>”;
}
?>
The above title is designed to provide the following functionality:
1.) It sets unique title for all of your WordPress unique URLs (posts, pages, pagination, archives, categories, etc.).
2.) It eliminates duplicate title issues common with pagination and repetitive inclusion of blog name among post page and post titles.
3.) It allows you to define your own home page title tag and 404 page title tag. You can do that by replacing the values set below:
$definehometitletag='Your homepage title tag';
$definenotfoundpage='Page not found';
4.) Anything else; it displays your blog name as the title tag.
5.) It increases the prominence of important keywords in your title tag by removing the raquo in the first set of characters. This is done by putting the separator to the rightmost section of the title tag:
wp_title('',TRUE,'right');
Maintain blog crawlability while minimizing duplicate content
By default, all search engine bots are allowed to crawl a WordPress site. However, there can be redundant/duplicate content issues with this default setup. The best example is that archived and category pages basically contain the same content. And even these contents can also be found in the exact posts or front pages.
To maintain the desired crawlability of your pages while minimizing duplicate content, the following are suggested:
1.) Allow the crawling of search engine bots on only the following type of URLs:
a.) Posts
b.) Post pages
c.) Front page
d.) Categories
2.) Block search engines in crawling the rest of the URL types such as:
a.) Archive
b.) Paginated pages (except for category URLs where it’s needed for deep crawling of old posts)
c.) 404 pages
d.) Search result URLs
e.) Author pages
f.) Tags, etc.
The PHP code (you will paste this code in your theme header.php right after the title code above) that will implement this:
<?php
if ((is_archive()) && (!(is_category()))) {
echo '<meta name="robots" content="noindex, nofollow" />';
}
elseif ((is_paged()) && (!(is_category()))) {
echo '<meta name="robots" content="noindex, nofollow" />';
}
elseif ((is_single()) || (is_page()) || (is_front_page()) || (is_category())) {
echo '<meta name="robots" content="index, follow" />';
}
else {
echo '<meta name="robots" content="noindex, nofollow" />';
}
?>