Just wondering if anyone has done this for Vanilla 2 yet? I was thinking about developing a plugin that returned a dynamic sitemap.xml output whenever example.com/../sitemap.xml was requested, but I'm not sure that's the right way to go. I imagine the best approach would be to generate a flat sitemap.xml file every 24 hours or so. Any thoughts?
You can add this to .htaccess: AddType application/x-httpd-php .xml Then just make sitemap.xml as a PHP file that sends xml headers, like: <?php header('Content-type: text/xml'); print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> Then just use a while loop to print the relevant entries from the database in xml format
Thanks guys. Anyone know on average how many time a sitemap.xml file is likely to be requested in a given day by robots? If it happens a number of times and you had a lot of discussions, maybe it would be better if sitemap.xml was a flat file generated maybe once a day by a cron job or whatever... Just thinking about performance but it might not be an issue in this case.
Not entirely sure how many times, you could do an experiment. If you have a site, create a php sitemap that can be static, return xml headers. And log every time it was opened/read to database or flat file.