pluginpal / strapi-plugin-sitemap

🔌 Generate a highly customizable sitemap XML in Strapi CMS
https://www.pluginpal.io/plugin/sitemap
MIT License
251 stars 53 forks source link

Generate double loc item & miss some of the links in sitemap #73

Closed tmclouisluk closed 2 years ago

tmclouisluk commented 2 years ago

Bug report

Describe the bug

I found that there is some links missed and double generate links in sitemap. Links are generated by URL Bundles

a

Settings

URL Bundles 2

In config/plugins.js

module.exports = ({ env }) => ({
  'sitemap': {
    enabled: true,
    config: {
      autoGenerate: true,
      allowedFields: ['id', 'uid', 'slug'],
      excludedTypes: [],
    },
  },
  publisher: {
    enabled: true,
  },
});

Expected behavior

No duplicated loc items and all item in URL Bundles should be generated

System

boazpoolman commented 2 years ago

Hey @tmclouisluk

Thanks for the issue submission. I haven't seen this issue myself before.

Can you confirm that your PR (#74) fixes the issue? I can't seem to understand why. Please elaborate.

tmclouisluk commented 2 years ago

Hey @tmclouisluk

Thanks for the issue submission. I haven't seen this issue myself before.

Can you confirm that your PR (#74) fixes the issue? I can't seem to understand why. Please elaborate.

I found that strapi query will pick id randomly if you don't order it yourself. Therefore, in my case, since I have more than 100 items in URL Bundles, it will divide the links into parts. If picking id randomly, there will be some duplicated. That's the reason my bug happened.

Hence, I just put orderby id simply in core.js. Then it works right now :)

boazpoolman commented 2 years ago

Thanks for the fix @tmclouisluk !

Released with v2.0.7