Page 1 of 1

[FIX] sitemap.php exports duplicates of some urls

Posted: Fri Jul 31, 2009 5:09 pm
by Martin
Not sure what causes this but it does happen so I've hacked together a small fixed version of the file (see attached) which you replace the existing one with.

There's probably a simpler way to do this but my solution was literally to create an array of urls as they are output and each iteration does an in_array() check to see if the url has already been output before it continues. If it's a duplicate it's skipped and so on.

Simples... :)

Re: [FIX] sitemap.php exports duplicates of some urls

Posted: Fri Jul 31, 2009 9:18 pm
by Darntoothysam
Brilliantly fast execution of this fix. Thank you very much! Google is quite happy now :)

Maybe what happens is when a structure change happens or a 301 redirect is wrote. I've done both to the pages that were having problems, the answer could lie in that.