Problem/Motivation
sitemap.xml is generated containing duplicated links.
To reproduce:
Case 1) e.g. enable sitemap generation to Basic Pages, then create nodes for this bundle. After that create menu links using the node paths created previously, like, node/1, node/2, etc. The sitemap will contain both links to same paths.
Case 2) e.g. enable sitemap generation to Basic Pages, then create nodes for this bundle. Create custom links using the same paths created previously.
Proposed resolution
Creates a mechanism to check duplicated entries before generate the xml. This mechanism needs to check the link priority too, If there are two entries for the same link, the higher priority value should be used.
I'll work to submit a patch to the next week.
Comments
Comment #2
gbyte CreditAttribution: gbyte as a volunteer and commentedThis shouldn't be a problem to fix, as before the sitemap gets generated, all links are put into a private variable in the SitemapGenerator class. Maybe instead of
$this->links = array_merge($this->links, $links);
there should be a call to a new private function like this:
Will take a look at it soon, but maybe you have a better idea ;)
Comment #4
gbyte CreditAttribution: gbyte as a volunteer and commentedI simplified the plugin structure and implemented the duplicate check, however nothing fancy - no priorities are compared.
add_created_paths() is where you could implement some checking (priority/lastmod/path) before removing duplicates.