Creating a Google Sitemap in Movable Type

Jun 10

Google have started a new (June 2005) project called Google Sitemaps. The idea behind it is to give the Googlebot a helping hand when indexing your website. We are told that by adding a sitemap we allow for more efficient and tailored searches. Allowing the search engine to harvest links that it may otherwise miss.

According to Google using a sitemap will not give higher search rankings and still does not guarantee search placement.

So now for the technical bit. A site map is basically an XML document made up of links (URL's) from your site, obviously the more links the more accurately it will map to your website.

According to Google using a sitemap will not give higher search rankings and still does not guarantee search placement.

So now for the technical bit. A site map is basically an XML document made up of links (URL's) from your site, obviously the more links the more accurately it will map to your website.

Simple Google Sitemap template for Movable Type

The template below shows how to create a simple Google Sitemap of Blog entries for the Movable Type publishing platform. Simply create a new index template and plop the code in below. Remember to call the output file something like mt-google-sitemap.xml. Rebuild your site and voilĂ  you have your very own sitemap.

  1. <?xml version="1.0" encoding="<$MTPublishCharset$>"?>
  2. <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
  3. <url>
  4. <loc><$MTBlogURL$>
  5. <lastmod>
  6. <MTEntries lastn="1">
  7. <$MTEntryDate format="%Y-%m-%d"$>
  8. </MTEntries>
  9. </lastmod>
  10. <changefreq>monthly</changefreq>
  11. <priority>0.8</priority>
  12. </url>
  13. <MTEntries>
  14. <url>
  15. <loc><$MTEntryPermalink encode_xml="1"$></loc>
  16. <changefreq>weekly</changefreq>
  17. </url>
  18. </MTEntries>
  19. </urlset>

This will produce you a Sitemap that you can then submit to Google Sitemaps, it is possible to check your file by validating it against the Googlemap schema. We used an online XML document validator to check that the Movable Type template was correct.

So why create a Sitemap of your blog entries?

Well it has occured to us that we can encourage Google to keep a more accurate search of our site, this will become more important if we decide to erase blog entries in the future or modify their locations.


Filed under:
Web design
Posted by:
James Griffin
Dated:
June 10, 2005