As a Webmaster, one of the things you always need to be aware of is how well your the pages of your site are interlinked. This is a crucial factor in overall search engine performance, and simply assuming that your architecture is robust enough to handle this is definitely not the route you want to take.
Over time, you will likely accumulate tons of pages, and as this happens, the odds of certain pages getting buried to the point of becoming nearly inaccessible tend to go up.
To combat this, you can generate an XHTML sitemap that contains links to every page of your site.
Update: I no longer recommend or use an XHTML sitemap, and that’s why I’ve removed the sitemap links from this article. Search engines and technology have improved, and at this point, an XML sitemap is the way to go.
Now, some of you may be thinking that your archives essentially solve this problem, but in a vast majority of cases, you’d be wrong :)
Typically, WordPress archive pages (and other CMS archive pages, for that matter) do not contain links to all of your internal Pages and available syndication feeds. On top of that, most archives also fail to link to every Post like I do on my archives page. Edit: Link removed because I no longer run my archives page in this manner.
A properly-constructed XHTML sitemap solves this problem.
Why? Because Google Said So
In its Webmaster Guidelines, Google touts the merits of adding a sitemap to your site.
- Make a site with a clear hierarchy and text links. Every page should be reachable from at least one static text link.
- Offer a site map to your users with links that point to the important parts of your site.
I’d like to add that I’ve always looked at sitemaps as a helpful tool for the user. Some sites have confusing (read: poor) architectures, and oftentimes, it’s just easier to hit the sitemap and find what you need from there.
Bottom line — including a sitemap is easy, it’ll help your users, and it’s a great way to ensure that all the pages of your site are interlinked.
Download the XHTML Sitemap Generator Template for WordPress
Implementing an adequate sitemap is a simple task with WordPress, and to assist you with this, I’ve created a handy little XHTML sitemap generator.
No matter what theme or template you are using on your site, this XHTML sitemap will work (as long as you’re running WordPress). Best of all, you can easily activate your new sitemap by following these steps:
sitemap.phpto your active WordPress theme directory.
- In your WordPress administration panel, go to Write and then to Write Page.
- Fill in a title (it can be anything you want), do not enter anything into the text area of the post, and create a Post Slug called “sitemap.”
- Most important, from the Page Template dropdown box, select the Sitemap template.
- When you’re done, click on Create New Page.
The only catch is that the resulting page will be stripped of all styles, so there will be a bit of a visual disconnect between the sitemap and the rest of your site.
Check out what I mean in this sitemap example. Edit: Link removed.
Simple Styling Tutorial to the Rescue!
The good news, however, is that you can easily “style” your sitemap, even if you’re not that familiar with WordPress theme files, PHP, or XHTML.
So, if you want your new sitemap to blend nicely with the rest of your site, here’s what you need to do:
- Open up your
page.phpfile from your current WordPress theme 1, and save it as a new file — call it
new_sitemap.phpfile, delete all the code that lies between this snippet:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
and this one:
<?php endwhile; endif; ?>
- Open up my
sitemap.phpfile (download it here), and copy all of the code that lies between the opening and closing
- In the
new_sitemap.phpfile, paste the code that you just copied in between the two lines of code indicated in point #2.
Finally, in the
new_sitemap.phpfile, add this code at the very top of the file:
<?php /* Template Name: New Sitemap */ ?>
new_sitemap.phpand upload it to your server.
- Follow the instructions above, except in step #4, choose the New Sitemap template.
Now, quit reading this, and go bask in all your Google-compliant glory!