[FIX] sitemap.php exports duplicates of some urls

For Articles relating to more than one ISC version
Post Reply
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

[FIX] sitemap.php exports duplicates of some urls

Post 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... :)
Attachments
sitemap.zip
Sitemap (fixed version)
(1.01 KiB) Downloaded 531 times
Darntoothysam
Confirmed
Confirmed
Posts: 33
Joined: Wed Jun 17, 2009 8:47 pm

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

Post 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.
Post Reply