Notanotherdotcom/MarkupSitemapXML — pull request #9 by teppokoivula (2013-04-15 07:44:58+00:00)
Title: Support for Multisite and a bunch of other changes

Had to make MarkupSitemapXML work with Multisite module for a project I'm currently working on and thought it might make sense to share some changes I've made to this module. Support for Multisite has been asked at least once or twice on the forums, after all :)

Other changes I've included in this pull request are related to how, when and based on what data sitemap is generated:

* Instead of Page::render, I've changed the hook to ProcessPageView::pageNotFound

This way user can add sitemap.xml -page (rare, but possible need) and this module won't automagically override it

* I've added extra check to make sure that request URI actually ends with "/sitemap.xml" and doesn't just contain it

* Related to Multisite support I've made sure that a sitemap accessed via any existing page of a site (such as /foo/bar/sitemap.xml, if /foo/bar/ is an existing page) works properly, ie. contains only pages below it's directory and not all the pages of that particular website (which is a limitation enforced by protocol section of sitemaps.org.)

After this addition a site with MarkupSitemapXML enabled theoretically contains proper sitemap file in each individual directory, though naturally most people won't link them anywhere or use them in any other way -- it just means that you can use directory-based sitemaps if there's a need for that :)