Create an Effective Sitemap Page Template in WordPress

Sitemaps are great as long as they aren't complicated!

[This post is part of the Ultimate Guide to Launching a WordPress-Powered Blog series.]

[Are you looking for a Sitemap for Search Engines? This is a different concept covered here.]

This post is very similar to both content and form from the “Add an Archive Page” blog post but it’s still worth a few moments of your time! The bottom line is this: A sitemap can not only enhance usability for your readers but also provide both visitors and search engines a better site architecture in which to navigate!

If you’ve got the time then it is worth building one!

So, a very typical question is this:

What is the difference between a Sitemap and an Archive Page in WordPress?

Generally the differences are understood as such:

  1. An Archives Page typically shows posts that are date-based (day, month, year), either reverse chronologically or by category, tag, and other such top level sorting schema. The point is to provide a listing of your posts as you would typically understand an “archive” to have!
  2. A Sitemap is more of a listing of all the pages that exist on a property or blog. This can include posts but it is generally has more of the “static” pages, sub-pages, and a list of top-level navigational items (categories perhaps). If you have deep site architecture then you’d want a sitemap for sure.

So, why have both of them? The answer to that is quite simple: It depends. Why? Because from a content perspective the two could look very similar. In fact, if you take a look at my Archives Page and also my Sitemap Page you’ll see a lot of similarities:

  • Lists of posts in categories and/or date-based.
  • List of pages on blog.
  • A number of other elements that a blog owner might put in there.

So why have one if they are relatively the same? Why have both? Here are some thoughts:

  1. Depending on your blog you might favor one over the other. Personal preference plays a roll here.
  2. Your community and visitors might culturally understand one better than the other. Play to the community’s strengths and natural tendencies here!
  3. Your site might look more like a typical website and less of a blog. You might want to opt for a sitemap instead.
  4. Your site might have a blog but is really deep as it relates to pages, sub-pages, and sub-pages of sub-pages. You have some extensive site architecture and as such you’ll probably want a sitemap.
  5. Your design favors to have both which are displayed in different areas as it relates to the context of your site and design around it. Have both and have fun!
  6. And many other reasons.

So why do I have both? Simply because this blog is new enough to warrant both to see which one this community favors. Also, since I haven’t completely designed this blog yet in it’s final form (see post here on more about this) it’s fine to have both and provide alternate avenues for new visitors to browse my content.

Ultimately I’ll probably land with a combination of the two in a more “sitemap-esque” look when I finalize the design, but it seriously doesn’t hurt to have both.

3 Ways to Add a Sitemap Page in WordPress

The first is pretty simple: If your WordPress Theme (like Standard Theme, the one I’m using) comes with a page template for a sitemap then all you have to do is create a new page, choose the page template, and then hit publish!

Check it out:

Just a few clicks away... with the right WP Theme...!

Easy, right?

The second way is to use a WordPress Plugin. Here are a few that have worked well historically:

  1. Dagon Sitemap Generator
  2. WP Realtime Sitemap
  3. WP Simple Sitemap

There are many others out there and you can try them all of course or you can try the third way which might just be the best way (or second best to the first option above): Create your own Sitemap Page Template!

First, create a new sitemap.php file and upload it via FTP using your favorite app (here are the FTP apps that I use):

Just upload or create the new file via FTP.

and then just copy and paste the following code into that file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!--?php /* Template Name: Sitemap */ ?-->
<!--?php get_header(); ?-->
<div id="container">
<div id="content">
<div class="entry-content">
<h3>Pages</h3>
<h3>Feeds</h3>
<ul>
    <li><a title="Full content" href="feed:<?php bloginfo('rss2_url'); ?>">Main RSS</a></li>
    <li><a title="Comment Feed" href="feed:<?php bloginfo('comments_rss2_url'); ?>">Comment Feed</a></li>
</ul>
<h3>Categories</h3>
<h3>All Blog Posts:</h3>
<ul>
<ul><!--?php $archive_query = new WP_Query('showposts=1000&#038;cat=-8'); while ($archive_query--->have_posts()) : $archive_query-&gt;the_post(); ?&gt;
    <li><!--?php the_title(); ?--> (<!--?php comments_number('0', '1', '%'); ?-->)</li>
</ul>
</ul>
&nbsp;
<h3>Archives</h3>
&nbsp;

</div>
&nbsp;

</div>
</div>
<!--?php get_sidebar(); ?-->
<!--?php get_footer(); ?-->

I added this to the Twenty Ten Theme and it looks like this via FTP:

Click for larger view!

and here’s what it looks like actually in the template once you add it (as you would like in option 1):

Click for larger view.

You can, of course, customize the code for your needs but you’ll have most of the options that you need right there for your use!

I don’t use all of these options that are available (as you can see here) but you can!

Let me know if you have any questions and I hope this helps!

Finally, make sure to check out the Sitemap for Search Engines post which covers another type of sitemap.

[This post is part of the Ultimate Guide to Launching a WordPress-Powered Blog series.]

A Few Thoughts You Can Share from the Post:

27 Responses to “Create an Effective Sitemap Page Template in WordPress”

  1. Helmi Asyraf | Kissing Crust March 14, 2011 at 7:40 AM #

    I really love this post. Reason? It has solved the question that I always have since I start using WordPress i.e. the difference between sitemap and archives.

    Thank you.

    Cheers!

  2. Dylan Dodson March 14, 2011 at 1:09 PM #

    Cool!

  3. Adam March 14, 2011 at 3:13 PM #

    Done :)

  4. Fernando March 15, 2011 at 1:17 PM #

    Thank you for another useful post. I must say I am following this series with much interest. I chose to use the second plug-in you suggest. I tried to submit the page to the webmaster tools in Google and was not able to. It gives the error that it’s in html.

    Thanks for your help.

  5. Dave Anthold March 16, 2011 at 1:50 AM #

    So easy with the Standard Theme! Awesome. It makes me realize that I need to cut down on my categories and do quite a bit of re-organization. Thanks again.

  6. Andy Allen March 18, 2011 at 8:25 PM #

    I added a sitemap page and dig it. I have a question tho:

    I’m using ST. How do I get more than 5 Posts Per Category to list on the sitemap page? I would like to have maybe 10-15…won’t know until I actually see it. Here is what’s currently showing: http://www.andyallen.com/sitemap/

    Thanks!

    • John Saddington March 20, 2011 at 8:40 AM #

      you can actually change that in the sitemap.php file.

      • Andy Allen March 20, 2011 at 8:35 PM #

        That’s what I figured, but I wasn’t able to find a “show count” giving me the option to adjust the number of posts to show. I’m still a newbie with editing code so I’m not sure what I may need to add or where I can edit for that.

  7. panoet April 19, 2011 at 7:41 PM #

    I want to show only the post list without categories/date/anything based list. How can I do that?

    • John Saddington April 19, 2011 at 8:44 PM #

      you could edit out the above code that you don’t want to show.

  8. Calum Henderson May 23, 2011 at 9:51 PM #

    Love the Standard Theme! Makes so many things so easy, just like adding a sitemap.

  9. Matt Fraser May 31, 2011 at 1:58 AM #

    John,

    What about using an xml site map/plugin such as this one:

    http://wordpress.org/extend/plugins/google-sitemap-generator/

    That is do you use one and if so what settings to you choose?

    • John Saddington May 31, 2011 at 10:50 AM #

      matt,

      have you seen this post?

      http://tentblogger.com/seo-sitemap/

      • Matt Fraser May 31, 2011 at 2:34 PM #

        John,

        I have been all over your ultimate wordpres set up guide and some how I missed this post.

        I think I’m going to switch as it looks like a simply install and forget plugin.

        That being said, if changes are made on an xml sitemap is it necessary for the html sitemap to portray those changes, that is can the html sitemap and the xml sitemap “communicate” with one another?

        • John Saddington May 31, 2011 at 3:04 PM #

          the html sitemap is for users while the seo sitemap is for search engines. they won’t necessarily talk to each otehr but if you make a new page it should show up on the xml.

          • Matt Fraser May 31, 2011 at 6:17 PM #

            John,

            Thanks, thats what I wanted to know, that is, if the xml map would create a new page once it a new page was published and vice versa with the html sitemap.

            Thanks for answering my question.

  10. Brent October 11, 2011 at 12:53 AM #

    Thanks for the Standard Theme! It makes sitemaps and archives so easy for just starting out my blog.

Leave a Reply:

Gravatar Image