Web Development

How to Generate a Yahoo Sitemap with Movable Type

Recently, I discovered that Yahoo offers a way of submitting a simple sitemap to their Site Explorer service to let them know about all of the pages on your site. This is very similar in concept to Google’s sitemap protocol that was released last summer, but is just a simple text listing of URLs instead of a more complex XML document.

While doing some searching, I came across a method of converting a Google sitemap generated by Movable Type into the Yahoo sitemap format. While it works OK, I wanted to make a MT template that just did it for me automatically without worrying about an external PHP script and setting up cron jobs. So, here’s the code and instructions. I’m using Movable Type 3.3, but the steps should be similar for previous versions.

  1. In Movable Type, click on the “Templates” button on the left side of the screen.
  2. Click the “Create New Index Template” link toward the top of the screen.
  3. Under “Template Name” enter “Yahoo Sitemap”
  4. Under output file, type “urllist.txt”. This must be urllist.txt, or Yahoo might not find it correctly.
  5. In “Template Body”, copy and paste the code below
  6. Click the “Save and Rebuild” button at the bottom to save this template and generate it for the first time.
  7. At Site Explorer, type in the URL to your site/blog under “My Sites” and then click the “Add My Site” button. You’ll need to login with your Yahoo account at this point to continue.
  8. Click “Manage Site” next to the URL you just added.
  9. On the new page, type or paste “urllist.txt” into the textbox at the end of your blog URL and then click the “Add Feed” button. Note: You’ll want to go through the process of authenticating your site with Yahoo so you can receive more information about your domain. This involves downloading or creating an authentication key and uploading it to the root of your site. Once Yahoo sees this is done, it establishes the fact that you have control over that domain.

The Movable Type template code:

Note: This template will list all individual entry pages, category archives, and monthly archives. If you have daily or weekly archives, you can change the “archive_type=” value to “Daily” or “Weekly”.