How To Create A Sitemap For Wordpress Blogs
One of my goals with the recent redesign was to make WageRank more accessible to search engine spiders. I didn’t like seeing so many category pages in Google’s index so I blocked them with my robots.txt.
Once I did this, the spiders had no way of navigating through my site so I created a sitemap which lists all the posts in chronological order.
Here’s how I did it:
The first thing you need to do is download and install the Run PHP Plugin. This allows you to execute php code in your posts.
Next, I created a new page using the slug sitemap. In the body of the page, I have this code:
<?php
global $wpdb;
$allposts = $wpdb->get_results(”SELECT * FROM wp_posts WHERE post_type=’post’ AND post_status=’publish’ ORDER BY post_date DESC”);
foreach($allposts as $ap) {
$perma = get_permalink($ap->ID);
print “<a href=” . $perma . “>” . $ap->post_title . “</a><br/>”;
}
?>
Before you publish the page, you have to check the little “run PHP code?” box that was installed with the PHP plugin.
That’s it! You now have a sitemap page that points to every single post in your blog, making it easy for spiders to drill down to the important content.
Related Posts
Tools
Homepage Sitemaps
6 WordPress Template Fixes
ReviewMe, PayPerPost, and Microsoft
WageRank Sitemap

[…] Really Simple Sitemap is my first go at creating a plugin for Wordpress. It was inspired by these 2 useful posts by SEO Blackhat and WageRank. […]