pluginpal / strapi-plugin-sitemap

πŸ”Œ Generate a highly customizable sitemap XML in Strapi CMS
https://www.pluginpal.io/plugin/sitemap
MIT License
249 stars 53 forks source link

[FEAT] Ignore all content types but the created by content type builder, i.e., api content types #167

Closed SalahAdDin closed 2 months ago

SalahAdDin commented 5 months ago

Feature request

Summary

Checking the sitemap configuration for the setup of the URLs we find the following content-type hell: image

ExtraContentTypeSitemap

It shows a lot of content types that we don't want to make part of any website.

We manually excluded them, but they are too much for the beginning, and no, it does not only include third-party plugin types:

sitemap: {
    enabled: true,
    config: {
      cron: "* * * * 7",
      xsl: true,
      autoGenerate: false,
      caching: true,
      excludedTypes: [
        "admin::api-token",
        "admin::api-token-permission",
        "admin::transfer-token",
        "admin::transfer-token-permission",
        "admin::permission",
        "admin::role",
        "admin::user",
        "plugin::content-releases.release",
        "plugin::content-releases.release-action",
        "plugin::i18n.locale",
        "plugin::navigation.audience",
        "plugin::navigation.navigation-item",
        "plugin::navigation.navigations-items-related",
        "plugin::navigation.navigation",
        "plugin::sitemap.sitemap",
        "plugin::sitemap.sitemap-cache",
        "plugin::users-permissions.permission",
        "plugin::users-permissions.role",
        "plugin::users-permissions.user",
        "plugin::upload.file",
        "plugin::upload.folder",
      ],
    },
  },

Why is it needed?

As you can see, it is hard for the developer tool and check which content types we need to exclude from the sitemap one by one.

Suggested solution(s)

It would be better either to add a new property includeType or make the plugin check only the API content types, so things get easier, even more, it should only include those types and exclude the types we want from API content types since all plugins and Strapi content types are not public in the most of the cases.

As you can see from the comment yarn strapi content-types:list, the only content types we want to see are the following:

β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ api::about-me.about-me                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ api::category.category                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ api::education.education                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ api::post.post                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ api::profile.profile                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ api::project.project                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ api::tag.tag                                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ api::work-experience.work-experience         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Related issue(s)/PR(s)

Let us know if this is related to any issue/pull request.

boazpoolman commented 4 months ago

Hi @SalahAdDin

Thanks for reporting yet another great feature request! You really help us push our plugins to the next level.

About the sitemap plugin; we are currently in the process of migrating the plugin to the Webtools suite. Just now I've released the first beta version of the Webtools Sitemap Addon to NPM It has all the same features you're used to from the standalone Sitemap plugin, but uses the core Webtools plugin for it's URL management.

The issue you created about the "Ignore all content types..." is a feature that's already integrated in Webtools.

That being said I would love it if you could give Webtools and the Sitemap addon a try. I think you'll like it a lot.

SalahAdDin commented 4 months ago

Hi @SalahAdDin

Thanks for reporting yet another great feature request! You really help us push our plugins to the next level.

About the sitemap plugin; we are currently in the process of migrating the plugin to the Webtools suite. Just now I've released the first beta version of the Webtools Sitemap Addon to NPM It has all the same features you're used to from the standalone Sitemap plugin, but uses the core Webtools plugin for it's URL management.

The issue you created about the "Ignore all content types..." is a feature that's already integrated in Webtools.

That being said I would love it if you could give Webtools and the Sitemap addon a try. I think you'll like it a lot.

There are some issues with this, the first, it is not clear if we need to install core-webtools, so we installed only the adding and we got the issue: image

This happens when we don't setup the configuration, when we do it, it fails even to load the admin:

 οŒ’ ξ‚°  ~/Projects/Portfolio/backend ξ‚° ο„“  PBE-001-strapi-4 !4 ξ‚° yarn develop                                                                             ξ‚² βœ” ξ‚² 20s ο‰’ ξ‚² system ξ˜— 
βœ” Cleaning dist dir (10ms)
β ‹ Building build context
[INFO] Including the following ENV variables as part of the JS bundle:
    - ADMIN_PATH
    - STRAPI_ADMIN_BACKEND_URL
    - STRAPI_TELEMETRY_DISABLED
βœ” Building build context (107ms)
βœ” Creating admin (9161ms)
β ™ Loading Strapi[ERROR]  There seems to be an unexpected error, try again with --debug for more information 

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                                                                                                                                   β”‚
β”‚   Error: Error loading the plugin sitemap because sitemap is not installed. Please either install the plugin or remove it's configuration.        β”‚
β”‚       at Object.loadPlugins (/home/luisalaguna/Projects/Portfolio/backend/node_modules/@strapi/strapi/dist/core/loaders/plugins/index.js:83:13)   β”‚
β”‚       at async Strapi.loadPlugins (/home/luisalaguna/Projects/Portfolio/backend/node_modules/@strapi/strapi/dist/Strapi.js:311:5)                 β”‚
β”‚       at async Promise.all (index 3)                                                                                                              β”‚
β”‚       at async Strapi.register (/home/luisalaguna/Projects/Portfolio/backend/node_modules/@strapi/strapi/dist/Strapi.js:341:5)                    β”‚
β”‚       at async Strapi.load (/home/luisalaguna/Projects/Portfolio/backend/node_modules/@strapi/strapi/dist/Strapi.js:425:5)                        β”‚
β”‚       at async Object.develop (/home/luisalaguna/Projects/Portfolio/backend/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js:837:28)     β”‚
β”‚       at async develop (/home/luisalaguna/Projects/Portfolio/backend/node_modules/@strapi/admin/dist/_chunks/develop-YNTGWKMC.js:61:5)            β”‚
β”‚       at async Command.parseAsync (/home/luisalaguna/Projects/Portfolio/backend/node_modules/commander/lib/command.js:923:5)                      β”‚
β”‚       at async Module.runStrapiCommand (/home/luisalaguna/Projects/Portfolio/backend/node_modules/@strapi/strapi/dist/commands/index.js:130:3)    β”‚
β”‚                                                                                                                                                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Installing web tools works fine, but the sitemap cannot be enabled since the config is still broken.

So, it is not usable yet.

I think it is required to update the documentation!

boazpoolman commented 4 months ago

Could you report an issue on the webtools repo about this? I’ll take a look at it.

SalahAdDin commented 4 months ago

Opened: https://github.com/pluginpal/strapi-webtools/issues/150

boazpoolman commented 2 months ago

I'm going to close this issue.

This standalone Sitemap plugin will be deprecated when it's successor Webtools will be out of Beta. And seeing as this particular issue is irrelevant when using Webtools, there seems no reason to leave this issue open.