silverstripe-labs/silverstripe-googlesitemaps — pull request #63 by tractorcow (2014-01-27 22:02:23+00:00)
Title: BUG Fix issue with children of unpublished pages appearing in sitemap as apparent root pages

In sitetrees where an admin might temporarily unpublish a parent page of several child pages (such as a news or blog holder) those child pages are essentially orphaned on the live site. Unfortunately the sitemap.xml still attempts to list those child pages, but they are appearing as root pages due to the inaccessible parent. Of course, any of those links are 404s when accessed.

This fix ensures that any child of an unpublished page is hidden from the sitemap.

Tests included.