Google Sitemap Scripts

I’m in the habit of writing own scripts when I can, and since I hear alot of positive things about Google Sitemaps, and I didn’t find a script I liked out there, I decided to write a script to crawl one of my domains. Right now, it’s site-specific, since I’m excluding certain paths (e.g. AVI, RSS, #, and certain directories), but I should be able to modify it so I can use it for all of my domains. Once I add an UI, anyone should be able to use it to generate a sitemap.

One thing I overlooked is that the generated sitemap XML is static, so lastmod will always be outdated. An article suggested making the XML file dynamic. For example, hardcode <? echo $lastmod ?> and re-evaluate $lastmod in the XML file header.
P.S. So far, Google seems to like the dynamic sitemap I created. There’s one URL that’s broken; Not sure where its coming from…since I deleted that link from the site; it could be from Google cache. Now I have no clue how to track down this broken link, since I never saw the error using Xenu.

By the way, To enable PHP parsing of XML files:

  1. use: AddType application/x-httpd-php .php .htm .html .xml Note: You can do the same for .rss files and generate them dynamically.
  2. echo the XML header, which has xml with <? ?> which will be parsed as PHP.

One annoyance is XML with PHP parsing enabled won’t display correctly in NN or FF.

Related Posts

What's Your Take?