If I wasn’t a geek I wouldn’t have a blog, but this is the first time I’ve been moved to write a truly geeky blog entry. But hey, I’m quite proud of this Blogger hack that generates Google Site Maps, which were announced on Thursday. Google’s billing this as an experiment the aim of which is to see if webmasters can be trusted to provide information on the structure of their websites, including location of new pages, frequency of update, last update and the relative priority of each page.
Inclusion in Google brings loads of traffic and it’s important to people like me who use Google’s site search. I’m quite lucky because of the 475 pages I’d like to be indexed 468 are in, but I’ve no idea which seven have been excluded. Offering Google a sitemap may not ensure that those seven pages are added, but it should give Google a hint as to which seven pages I’d miss the least.
Details of the Google sitemap protocol are here and while I’m in no position to offer any form of technical support whatsoever, I have created a Blogger template that enables the creation of Google sitemaps. You are welcome to use this as you see fit, and while I can’t oblige you to post a link and thank-you on your own blog, that would be nice.
How to generate the sitemap et cetera…
BAD NEWS: This only works if you’re able to upload files directly to your blog’s host directory. In other words, this is no use to Blogspot users.
DISCLAIMER: I’m sorry if you get lost (make sure you’ve backed up your template) or if anything goes wrong, but I’m not able to offer technical support or take responsibility for anything.
GOOD NEWS: You never hit publish as the sitemap appears in the Blogger preview window. (If you do hit publish you’ll be making a terrible mistake.)
At time of writing the sitemap protocol includes four sub tags, your sitemap will include all except <lastmod>, which isn’t very important anyway. So here we go…
- Simply replace your Blogger template with the one below. Don’t save template changes
- Hit ‘preview’ and a Google sitemap appears. Hit ‘Clear Edits’ and your proper template should reappear (if not restore from back-up).
- Cut and paste the sitemap into a text file (use Notepad, which is usually found in ‘All Programs > Accessories’).
- Change ‘http://YOUR-BLOG-HOMEPAGE-URL’ and ‘http://YOUR-BLOG-SITEFEED’ as appropriate.
- <priority> tag: Pages are assigned priorities on the scale 0.0 to 1.0. These are relative so scoring every page 1.0 is the same as scoring every page 0.0. I’ve suggested scoring the homepage and site feed as 0.8, archives 0.6 and ordinary posts 0.4. So the homepage is twice as important as an ordinary post, while an archive is somewhere in between. But you do what you like.
- <changefreq> tag: You can tell Google how often pages are updated. I’ve suggested the homepage and site feed change daily, while archives and individual posts never change. Check here to see what you can change this to. (You may also wish to change the <changefreq> on your current archive page manually from ‘never’ to ‘daily’.)
- Save the sitemap as ‘sitemap.xml’ making sure ‘UTF-8’ encoding is selected.
- Upload this file to your blog’s host directory i.e. to create the URL ‘http://YOUR-BLOG-HOMEPAGE-URL/sitemap.xml’.
- Notify Google and you’re done.
- Feel free to link back to this page: http://www.stephennewton.com/2005/06/google-sitemap-for-blogger.html as a thank-you.
Only posts currently included on your homepage are mapped; to do the whole blog change go to formatting in your blog settings and change the number of posts on your main page to 999 (Blogger imposed maximum), but don’t select either republish option and remember to change it back when you’re done.
Obviously, you can reprioritise certain posts manually. If you do, rather than re-create a whole new sitemap and lose those changes, forget about changing the number of posts to 999 and cut and paste the <url>……</url> tag sets for your most recent posts into your first sitemap. Sadly, you’ll have to update the sitemap and notify Google manually. I’ll probably update weekly.
Here’s the code, with stuff you’ll need to change or want to play with in bold…
<?xml version=”1.0″ encoding=”UTF-8″?><br>
<urlset xmlns=”http://www.google.com/schemas/sitemap/0.84″><br>
<!– GOOGLE SITEMAP GENERATOR TEMPLATE FOR BLOGGER USERS –><br>
<!– BY STEPHEN NEWTON JUNE 2005 WWW.STEPHENNEWTON.COM –> <br>
<!– INDEX PAGE & SITE FEED –><br>
<url><br>
<loc>http://YOUR-BLOG-HOMEPAGE-URL</loc><br>
<priority>0.8</priority><br>
<changefreq>daily</changefreq><br>
</url><br>
<url><br>
<loc>http://YOUR-BLOG-SITEFEED-URL</loc><br>
<priority>0.8</priority><br>
<changefreq>daily</changefreq><br>
</url><br>
<!– ARCHIVE PAGES –><br>
<BloggerArchives><url><br>
<loc><$BlogArchiveURL$></loc><br>
<priority>0.6</priority><br>
<changefreq>never</changefreq><br>
</url><br>
</BloggerArchives><br>
<!– INDIVIDUAL POSTS –><br>
<BLOGGER><url><br>
<!– <BlogItemTitle><$BlogItemTitle$></BlogItemTitle> –><br>
<loc><$BlogItemPermalinkURL$></loc><br>
<priority>0.4</priority><br>
<changefreq>never</changefreq><br>
</url><br>
</BLOGGER></urlset>





















































