Fix #559, make sitemap flat view work.

I've also added some `window.history.pushstate` support for some extra flare points
Spaces vs tabs, I'll reformat the file and add it to the pull.