Creating a blog sitemap with Movable Type

| | Commenti (4) | TrackBack (0)

Movable Type provides an excellent template engine that can be easily tweaked to create a XML Sitemap. Basically, you just need to create a new template and ask Movable Type to rebuild it each time your blog is updated.

The Sitemaps Protocol allows you to inform search engine spiders about URLs on your websites that are available for crawling and helps search engines to find all your pages.

To create a new template enter the Movable Type administration panel.
Blog Dashboard > Templates > Indexes and press Create New Index Template to add a new template to your blog configuration.

Choose an easy to understand Template Name — for example Sitemaps — and an easy to remember file name — for example sitemap.xml. Allow Movable Type to rebuild the template automatically when rebuilding index templates and fill the Template Body textarea with the following code

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc><$MTBlogURL encode_xml="1"$></loc>
<priority>1.0</priority>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.simonecarletti.com/blog/index.xml</loc>
<priority>1.0</priority>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.simonecarletti.com/blog/atom.xml</loc>
<priority>1.0</priority>
<changefreq>daily</changefreq>
</url>
<MTEntries lastn="9999">
<url>
<loc><$MTEntryPermalink encode_xml="1"$></loc>
<lastmod><$MTEntryModifiedDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></lastmod>
</url>
</MTEntries>
<MTIfArchiveTypeEnabled archive_type="Category">
<MTTopLevelCategories>
<MTIfNonZero tag="MTCategoryCount">
<url>
<loc><$MTCategoryArchiveLink$></loc>
</url>
</MTIfNonZero>
<MTSubCatsRecurse>
</MTTopLevelCategories>
</MTIfArchiveTypeEnabled>
<MTIfArchiveTypeEnabled archive_type="Monthly">
<MTArchiveList archive_type="Monthly">
<url>
<loc><$MTArchiveLink$></loc>
</url>
</MTArchiveList>
</MTIfArchiveTypeEnabled>
</urlset>

Please note that bold styled strings must be replaced with your own values. Save the new template and... your new sitemaps is created.

Sitemaps Template

That's all! Now login into your Google Account, go to the Sitemaps admin panel and submit your sitemap to Google.

Before closing this article, let give a look at the template code.

First of all, according to Google Sitemap Specifications, you need to declare the XML file and schema.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">

Now you are ready to start your URL list.
Add your blog main URL using <$MTBlogURL encode_xml="1"$> template tag. Set the higher priority value and (if needed) and update frequency.

<url>
<loc><$MTBlogURL encode_xml="1"$></loc>
<priority>1.0</priority>
<changefreq>daily</changefreq>
</url>

Then list the Atom and RSS feeds

<url>
<loc>http://www.simonecarletti.com/blog/index.xml</loc>
<priority>1.0</priority>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://www.simonecarletti.com/blog/atom.xml</loc>
<priority>1.0</priority>
<changefreq>daily</changefreq>
</url>

and all entries.

<MTEntries lastn="9999">
<url>
<loc><$MTEntryPermalink encode_xml="1"$></loc>
<lastmod><$MTEntryModifiedDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></lastmod>
</url>
</MTEntries>

Finally, complete the recipe with all category indexes

<MTIfArchiveTypeEnabled archive_type="Category">
<MTTopLevelCategories>
<MTIfNonZero tag="MTCategoryCount">
<url>
<loc><$MTCategoryArchiveLink$></loc>
</url>
</MTIfNonZero>
<MTSubCatsRecurse>
</MTTopLevelCategories>
</MTIfArchiveTypeEnabled>

and monthly archives, if they are enabled.

<MTIfArchiveTypeEnabled archive_type="Monthly">
<MTArchiveList archive_type="Monthly">
<url>
<loc><$MTArchiveLink$></loc>
</url>
</MTArchiveList>
</MTIfArchiveTypeEnabled>
</urlset>

Note.. The original tutorial was posted by Nial Kennedy. The code published above is an updated version based on the original one.

Italian version: Crea la tua sitemap con Movable Type.

0 TrackBacks

Listed below are links to blogs that reference this entry: Creating a blog sitemap with Movable Type.

TrackBack URL for this entry: http://www.simonecarletti.com/mt4/mt-script-tb3.cgi/140

4 Comments

JiggaDigga said:

Great reading, keep up the great posts.
Peace, JiggaDigga

Laurent said:

Thanks for this tip, it was helpful to me.
Just for your info, Google News will crawl your site if you register it.
Now sitemap.xml must have a max of 1000 entries in order to be working properly. We have a big blog and we recently realized we were not on Google News any more. So change the entry <MTEntries lastn="9999"> to 1000 max if Google News referencing matters to you.

Hi Laurent,
I'd like to clarify that the limit of 1000 entries is only for News Sitemaps, not for Classic Sitemaps. :)

Leave a comment

Disclaimer:
SPAM comments or messages posted just in order to take advantage of search engines popularity might be removed without any notice.
Comments are filtered against Akismet antispam service, keyword filters and blacklists.

FeedBurner Network

Questo blog è parte del network Web Marketing e Motori di ricerca (a FeedBurner Network).

Scopri di cosa si tratta (sì, lo so, il post introduttivo è un po' lungo...)

Non perderti gli aggiornamenti

Feed Sottoscrivi il feed

Non conosci i feed RSS? Hai paura che sia una fregatura? Questa breve presentazione fa al caso tuo... prenditi 5 minuti, è divertente! :)

servizi e curiosità

Add to Technorati Favorites
Aggiungi il blog al tuo elenco di preferiti su Technorati.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 4.1