HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

sitemap.xml auto creation

derekdonderekdon New
edited February 2010 in Vanilla 2.0 - 2.8
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?


  • SubJunkSubJunk ✭✭
    edited February 2010
    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
  • You don't even need the .xml extension for the sitemap i don't think. As long as it sends xml headers and is constructed correctly.
  • Yeah, you are right, it's just nice to keep to the convention of the sitemap being /sitemap.xml
  • 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.
  • @garymardell - Cheers, I'll look into it...
  • @derekdon
    Ill do it for my site listflock, and just store to flat file or something to test.
  • scottyscotty
    edited April 2010
  • TimTim Operations Vanilla Staff
    Check out this new plugin, which creates and maintains a www.sitemaps.org compatible sitemap for your forum.


    Vanilla Forums COO [GitHub, Twitter, About.me]

Sign In or Register to comment.