Login | Sign Up Register with Facebook

Cameron's Thoughts

Why would you want to know what I'm thinking? Weirdos.

Sitemaps - Latest Update

I have updated my sitemap and the new one is now based on Niall Kennedy's template that he created. This template outputs the exact same sitemap I had setup before, but that one was using the sitemap generator and a config.xml file along with a urllist.txt file that was outputted using Movable Type. This new template just outputs the XML file straight from Movable Type. The template I created outputs the main index page, all individual archives and also monthly and category archive links in the sitemap.

Here is my latest template:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">

<url>
<loc><$MTBlogURL encode_xml="1"$></loc>
<changefreq>daily</changefreq>
<MTEntries lastn="1">
<lastmod><$MTEntryModifiedDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></lastmod>
</MTEntries>
<priority>1.0</priority>
</url>

<MTArchiveList archive_type="Individual">
<url>
<loc><$MTArchiveLink encode_xml="1"$></loc>
<lastmod><$MTArchiveDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></lastmod>
<priority>0.8</priority>
</url>
</MTArchiveList>

<MTArchiveList archive_type="Category">
<url>
<loc><$MTArchiveLink encode_xml="1"$></loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
</MTArchiveList>

<MTArchiveList archive_type="Monthly">
<url>
<loc><$MTArchiveLink encode_xml="1"$></loc>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
</MTArchiveList>

</urlset>

To set this up on your own installation, simply copy the code into a new index template and set it to output as sitemap.xml or whateveryouwant.xml.

13 comments

Avatar for Piers Young

Really don't mean to be picky - because this is great stuff! - but I tried having a look at your updated live version and got this: A name was started with an invalid character. Error processing resource 'http://www.cbulock.com/templates/Sitemap'. Line 8... <loc><$MTBlogURL encode_xml="1"$></loc> ------^ It may well be my fault - how do I get to see it? Anyway thanks for the good work :)

Avatar for Cameron Bulock

No, actually it's not you. It's Internet Explorer. It's trying to render it as an XML file instead of a text file. I just use Firefox and that displays the page right so I hadn't noticed. As of right now, the code displayed on this page is the same as the live template I am using. I will try getting that issue resolved shortly so it will display in IE too. As for now, you can also just do a 'Save Target As' in IE and save it as a text file.

Avatar for Tj

Great stuff. One small change for me to get it to work correctly with my site and Google. Under the daily freq, to get the main url time correct - Had to change: <lastmod><$MTEntryModifiedDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></lastmod> To: <lastmod><$MTArchiveDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></lastmod> The MTEntryModifiedDate was producing a barfed date that Google was hanging on. Great Work!

Avatar for Tj

Sorry about the previous post - the text did not render proper. Simply change the MTEntryModifiedDate to MTArchiveDate in the first URL section.

Avatar for Paul

I tried this code on my site. I get an Invalid Date error. I have dropped off $MTBlogTimezone$ and resubmitted. Maybe it is due to the fact I am in GMT+9 ?

Avatar for JDG

Does anyone know how to create a categorized list of entries in a Google site map?

Avatar for Mecandes

Does it also make sense to add the Google Sitemap ping URL to the Movable Type preferences "Publicity/RemoteInterfaces/TrackBack" list? Would that work?

Avatar for Cameron Bulock

The method Google uses to ping the sitemap URL is different than the method that Movable Type uses to ping sites, so it wouldn't work. Might be a cool thing to make a plugin for though

Avatar for Brent

I've heard alot about using the Google sitemap ,xml file, but does this process actually help your SE rankings?

Avatar for MovableType Blogger(JP)

Great! I'll use this.

Avatar for ldelavaissiere

If you want to publish a search engine independent sitemap in ROR format, I have compiled a Movable Type template <a href="http://laurent.delavaissiere.net/blog/2006/04/making_search_engines_life_eas.html">here</a>. http://laurent.delavaissiere.net/blog/2006/04/making_search_engines_life_eas.html

Avatar for blue scarf

very useful ,thanks.

Avatar for vacature

I really enjoyed reading this post, big fan. Keep up the good work and please tell me when can you publish more articles or where can I read more on the subject?

You will need to be logged in to add any comments.