zendframework/zf-web — pull request #105 by tfountain (2013-06-14 20:00:24+00:00)
Title: XML sitemap for manual

This PR adds an XML sitemap module, along with a couple of changes elsewhere that were required to make this work.

The main purpose of this is to use the sitemap's 'priority' field in order to influence which versions of the documentation search engines include in their listings. At the time of writing, 2.2 is the current ZF version, yet most ZF-related Google searches link to the older 2.0 documentation (or sometimes 1.12).

The priority settings here use the standard priority (0.5) for the current release version, a lower priority (0.3) for the last major release of 1.x, and the lowest priority (0.1) for all other versions.

I had to make a change to the routing in the Manual module to make this work, as the `:page` param in the manual route often contains a slash (e.g. `modules/zend.view.helpers.html`), and this gets URL encoded by default when Zend Navigation is assembling the sitemap URLs. So I added a `Manual\Route` class which extends the segment route class purely to add the slash character to 'allowed' list.

The sitemap itself is generated on the fly, however this recursively crawls through the file structure for every documentation release so it may be too slow in production. As an alternative I've included a standalone script (`bin/update-xml-sitemap.php`) that will write the sitemap out to the public folder when called. So this could easily be added to the Makefile.