WordPress: XHTML Sitemap Generator Template
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.
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.
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.
How to implement?
- Download XHTML Sitemap Generator, and extract on your local folder.
- Upload
sitemap.phpto your active WordPress theme directory. - In your WordPress administration panel, go to Write Page.
- Fill in an appropriate Page title, and leave the text area of the post empty. Fianlly, create a Post Slug called “sitemap.”
- Select Sitemap template from the Page Template dropdown box on the siderbar.
- When you’re done, click on Create New Page.
Note: 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.
Page Styling!
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, and save it asnew_sitemap.php. -
In the
new_sitemap.phpfile, delete all the code that lies between the under given lines:<?php if (have_posts()) : while (have_posts()) : the_post(); ?>and this one:
<?php endwhile; endif; ?> - Open
sitemap.phpfile (download it here), and copy all of the code that lies between the opening and closing<body>tags. - 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<br />/*<br />Template Name: New Sitemap<br />*/<br />?> - Save
new_sitemap.phpand upload it to your server. - Follow the instructions above, except in step #4, choose the New Sitemap template.
WordPress XHTML Sitemap Generator Template

Leave a comment »