BoxLang 🚀 A New JVM Dynamic Language Learn More...

Preside Extension: XML Sitemap

v1.2.3+0000010 Preside Extensions

Preside Extension: XML Sitemap Extension

An extension for Preside that will create sitemap.xml for all active pages.


From the root of your application, type the following command:

box install preside-ext-sitemap


The sitemap file will be generated by the scheduled task in your webroot. You should add the following pattern to your .gitignore file to keep it out of your repository:


Making your sitemap available to Google

There are two different ways to make your sitemap available to Google:


  • Insert the following line anywhere in your robots.txt file, specifying the path to your sitemap:


Adding custom pages to your sitemap

By default, the extension will add all the active pages from your sitetree to the sitemap.

It may be that you have some custom, dynamically generated pages which you also wish to add (for example, news pages stored in a separate Preside object). There is an interception point, postPrepareXmlSitemapPages, which is called before the pages get built as an XML sitemap file. Available interceptData is pages (the array of sitemap pages already prepared) and siteId.

You can use whatever logic you want in your interceptor to gather pages to append to the array. Each array item is a struct containing the following keys:

  • loc (required) - the complete URL of the page
  • lastmod (required) - the date the content was last modified
  • priority (optional) - the priority of the page; one of important, high, normal, low. Defaults to normal
  • changeFreq (optional) - how often you expect the content to change; one of always, hourly, daily, weekly, monthly, yearly, never. Defaults to always

Multiple sites

The extension handles multiple sites out of the box. As noted above, the postPrepareXmlSitemapPages interceptor receives the siteId of the current site, for you to handle however you like.

In your Preside site settings page, there is a Sitemap tab. On here you will find a couple of options.

By choosing Exclude from sitemap, the site will be skipped completely when generating sitemaps.

You may also set a Sitemap suffix which is used to create the sitempa's filename. This is advisable when working with multiple sites, as each site will have its own sitemap. For instance, if you set a value of subsite here, the site's sitemap will be saved to /sitemap-subsite.xml. If you leave this empty, the file will be saved to /sitemap.xml.



  • #13 - Announce interception point after writing to file


  • Convert to github build system
  • Add German i18n translations


  • Change build/publish process
  • Add 'postPrepareXmlSitemapPages' interception point to append custom pages to sitemap
  • Add support for multiple sites


  • Add default value to sitemap_priority


  • Add ability to set sitemap changefreq on individual pages


  • Add ability to set sitemap priority on individual pages


  • Increase schedule task timeout
  • Don't use cache for page query
  • Build XML text manually for improved readabilty
  • Don't add .html to URL if page is homepage
  • Clarify checkLivePage() logic, improve var-scoping
  • Code style formatting


  • Use correct repo url in box.json


  • Fixing up publishing process


  • Boxifying the repo with automated publish


  • Ensures repeated process is reduces to improve the speed


  • couple of function name that was missed previously


  • Amendment to function names
  • Add missing arguemnt type in rebuildSitemap function
  • Update backend service to improve performance when building sitemap


  • Added instruction for submitting the sitemap / adding to robots.txt
  • Updated typo for "last" in variable "elemLastMod"
  • FIX for fileWrite throwing a error can't write down object of type [struct] to resource - always ensure the outut is a string / simple value
  • Add logger key exists checker before logging info and error message
  • Add logger info when sitemap task is being run


  • Add
  • Initial import of extension from Nelson's work

$ box install preside-ext-sitemap

No collaborators yet.
  • {{ getFullDate("2017-07-09T05:47:42Z") }}
  • {{ getFullDate("2023-03-01T15:06:48Z") }}
  • 2,988
  • 100,379