Jim Westergren
About me, my projects, SEO, Web Development and Personal Development since 2005
"If we did all the things we are capable of, we would literally astound ourselves." - Thomas A. Edison

Tutorial: Automatic Site Map for WordPress

To improve the navigation of your users as well as search engine traffic and ranking to your WordPress blog I suggest making a good site map of your posts - a map of your site. A kind of user friendly archive of your posts. This is not "Google sitemap"!

The benefits:

There are 3 different versons of site maps that you can use, depending on how you want it. I have used the other 2 until I reached my final which is the first I want to brief you about.

The First WordPress Site Map Example

This one is the nicest, most flexible and best if you write about different subjects but takes some time to set up. Once it is set up it is all automatic. If you have many categories and subcategories this is the best choice for user experience. You can fully decide the headings, order and basically everything. This is the final one for this blog which I currently use and developed myself.

Demo: See my site map here.

Guide how to set it up

  1. Download and activate the PHP Exec plugin (for newer versions of WordPress use Exec-PHP) that makes it possible for you to parse PHP in your blog posts.
  2. Download and activate the WP Category Post Plugin that makes it possible for you to list posts per category. (I revised the file a bit, credits to Brian Groce and CrazySerb).
  3. Create a new WordPress page (not post) with something like this: <h1 style="margin-top:10px;">Major category</h1> <div style="margin-left:70px;"> <h2>Subcategory</h2> <ul> <?php wp_cat_posts(21); ?> </ul> <h2>Subcategory</h2> <ul> <?php wp_cat_posts(38); ?> </ul> <h2>Subcategory</h2> <ul> <?php wp_cat_posts(27); ?> </ul> <h2>Other posts on main category</h2> <ul> <?php wp_cat_posts(29); ?> <?php wp_cat_posts(30); ?> </ul> </div> The numbers are the IDs of the categories. Repeat this code until you cover all your categories. You can then place a index with anchor links that jumps to sections like I did. You don't need to include all posts and you can choose the exact sequence you want.
  4. In your template footer file and or at some other visible place, make a link pointing to your site map for full visitor and search engine link benefit.

The Second WordPress Site Map Example

Use the DDSitemapGen. It is an extensive plugin with a lot of options and is 100% automatic. Just follow the instructions on that site on a new site map page and then in your template footer file and or at some other visible place, make a link pointing to your site map for full visitor and search engine link benefit.

The Third WordPress Site Map Example

This is best if you have a blog in just one subject and is simply just a list of all pages of your blog which can be sorted by date.

Demo:

Here is a demo of just 5 posts:

Guide how to set it up

  1. Download and activate the PHP Exec plugin (for newer versions of WordPress use Exec-PHP) that makes it possible for you to parse PHP in your blog posts.
  2. Create a new WordPress page (not post) with some text and then the following lines:

    <div style="width:300px;margin-left:50px;font-size:10px"> <br /><br /> <phpcode> <ol> <?php wp_get_archives('type=postbypost'); ?> </ol> </phpcode> </div>

    There is more about wp_get_archives here.

  3. In your template footer file and or at some other visible place, make a link pointing to your site map for full visitor and search engine link benefit.

Which kind of site map do you use for your WordPress blog? If you are using the first version it would be nice if you commented with a link to it so we can see how it works for your WordPress blog.

Note: This tutorial was originally written on the January 06, 2006 but was majorly revised and republished on the October 22, 2006. The original article basically just mentioned the third site map version.

22 Oct 2006

About the Author Jim Westergren Jim Westergren is a Swedish web entrepreneur currently living in Spain. He is happily married and has three lovely children. Some of his interests are web development, SEO and writing.
He is the Founder of DomainStats and N.nu. Read his .