Dynamic Sitemapping Made Easy

December 23, 2006 – 8:58 am

I was reading through Peasonified.com yesterday and I came across an interesting article with some tips that I just had to try out. CommerceCubes is quickly becoming a place in which I can hone my skills in all things “web”. Every time that I learn something new I feel as though I must share it because as my knowledge increases I realize that so does anyone who comes across this site gets increased knowledge and value out of it which is the main reason why I started the site in the first place. Sure the first 6 months I’ve tried to find a reason for CommerceCubes existing and only recently I am realizing that reason is simple “To share knowledge and information in an entertaining way”… or at least I hope its entertaining :D

Getting back to what I found on Pearsonified I’ve got to say that if you are new to web development its still a very interesting read that I’d highly recommend. That being said I wanted to share this Sitemapping option that was originally posted on Pearsonified.com a few weeks back. I’ve posted the steps given to developing your own dynamic XHTML Sitemap in WordPress but have a good read of the article at Pearsonified as well. It’s worth the time.

Download the XHTML Sitemap Generator Template for WordPress

XHTML Sitemap Download IconImplementing 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:

  1. Upload sitemap.php to your active WordPress theme directory.
  2. In your WordPress administration panel, go to Write and then to Write Page.
  3. 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.”
  4. Most important, from the Page Template dropdown box, select the Sitemap template.
  5. 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.

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:

  1. Open up your page.php file from your current WordPress theme 1, and save it as a new file — call it new_sitemap.php 2.

2. In the new_sitemap.php file, delete all the code that lies between this line:

< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>

and this one:

< ?php endwhile; endif; ?>

  1. Open up my sitemap.php file (download it here), and copy all of the code that lies between the opening and closing tags.
  2. In the new_sitemap.php file, paste the code that you just copied in between the two lines of code indicated in point #2.

5. Finally, in the new_sitemap.php file, add this code at the very top of the file:

< ?php
/*
Template Name: New Sitemap
*/
?>

  1. Save new_sitemap.php and upload it to your server.
  2. 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!

Source: Pearsonified.com

I’ve personally installed this on CommerceCubes but I am having a few problems with it but I am working the bugs out, so to speak. I also loaded it on my other site that is currently in development and it loaded perfectly. I am getting the following error implementing the CommerceCubes sitemap. If anyone has any thoughts or suggestions feel free to speak up.

The requested URL /publication/sitemap/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Talk to you soon and let me know if you have any ideas. I am all ears :D

Luc

Post a Comment