I decided to write a shell BASH script which can be run as a CRON job to generate a sitemap index file for Google Sitemaps. A sitemap index file points to all of your sitemaps for a particular domain (eg. http://www.sprayfly.com/)and Google will crawl each one of these indexed sitemaps individually. I want to regenerate the sitemap index file every day so that the <lastmod> date changes every day. This ensures that Google keeps checking your sitemaps.

The script is set up to index three different sitemaps but contains instructions on how to modify it to add more. Just download it, upload it to your server (behind the public_html directory), give it execute permissions and run it (as a CRON job if you want):

mv sitemapgen.txt sitemapgen.sh
chmod +x sitemapgen.sh
./sitemapgen.sh

Download the script

Leave a Reply