Duplicated entries for products
manmartinez opened this issue · comments
Manuel Martinez commented
Hi! So I generated my sitemap using rake -s sitemap:refresh
and noticed there were two entries per product:
<url>
<loc>http://shop.demo.org/products/spree-baseball-jersey</loc>
<lastmod>2014-10-06T17:52:30+00:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://shop.demo.org/products/spree-baseball-jersey</loc>
<lastmod>2014-10-06T17:52:30+00:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
This probably has to do with using Spree::Product.active
scope since it joins with the master variant and its prices, is there any way to get around this?
Jeff Dutil commented
The active scope should be fixed to not duplicate entries. Or remove the duplicates here https://github.com/JDutil/spree_sitemap/blob/master/lib/spree_sitemap/spree_defaults.rb#L25
Manuel Martinez commented
Maybe something like:
active_products = Spree::Product.active.uniq
Jeff Dutil commented
Yea you should be able to do that at the line I linked to for a workaround, but the proper solution is to fix the active scope to return unique products