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

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 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?


  • Options
    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
  • Options
    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.
  • Options
    Yeah, you are right, it's just nice to keep to the convention of the sitemap being /sitemap.xml
  • Options
    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.
  • Options
    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.
  • Options
    @garymardell - Cheers, I'll look into it...
  • Options
    Ill do it for my site listflock, and just store to flat file or something to test.
  • Options
    edited April 2010
  • Options
    TimTim Operations Vanilla Staff
    Check out this new plugin, which creates and maintains a compatible sitemap for your forum.

    Vanilla Forums COO [GitHub, Twitter,]

Sign In or Register to comment.