pluginpal / strapi-plugin-sitemap

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

Feature request: an ability to use the same collection with different patterns #60

Open AlexDede opened 2 years ago

AlexDede commented 2 years ago

Feature request

Summary

Can you add an ability to specify a few patterns for the same collection?

For example I have collection products and I want to have a few patterns for it. For example:

/products/[id] /products/[id]/another-slug-1 /products/[id]/another-slug-2

Why is it needed?

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Suggested solution(s)

There are 2 options for that:

boazpoolman commented 2 years ago

Hey @AlexDede

Thank you for the feature request. I just want to clarify a couple of things.

How do you want to use the multiple patterns for a single collection type?

AlexDede commented 2 years ago

Hey @boazpoolman

Thank you for the reply.

How do you want to use the multiple patterns for a single collection type?

In my case I only need this for multi collection type. But I think that in some cases single collection type can be used for a few URLs on a site too (use different parts of data from single collection type).

Select which pattern to use for each collection entry

In my case I need each pattern for each collection entry and I think it will be enough for first version of this feature. In the future maybe it is possible to add an ability to select patterns to the block on a screenshot below.

image

boazpoolman commented 2 years ago

So if I understand correctly; you would end up with multiple URLs in the sitemap which will go to the same page?

Like: /products/1 /products/1/addition /products/1/other-addition

Which all correspond to the same entry (id: 1) in Strapi. And also all show the same page in your website.

Why would you want that?

AlexDede commented 2 years ago

you would end up with multiple URLs in the sitemap which will go to the same page?

Not exactly. In our case all this pages will be related to the same product but will show different parts of information related to this product. For example:

/products/1 -> some general information about the product with id=1 (like name, image, description, etc.) /products/1/specifications -> specification of the product with id=1 (like width, height, weight, etc.) /products/1/addition -> addition information about the product with id=1

But all this part of data will be saved in the same collection in Strapi with the same entry with id = 1.

boazpoolman commented 2 years ago

Ah allright, I get it.

Let me think about this for a little. Probably just allowing a collection type to be used multiple times in URL bundles does the trick.

saeed-f commented 1 year ago

Probably just allowing a collection type to be used multiple times in URL bundles does the trick.

We also need this feature in our project, we need multiple URL bundles for one collection type. is there an update on this? or any other solution we could use?

If you could give me a general idea of how it works or where to start, I'd be happy to give it a try and make a PR if it works.

Namstel commented 12 months ago

Hey @boazpoolman.

We too need this. Here's why:

I had a pop at getting this working myself in a fork, but not having any React experience is really holding me back, and it all seems tighly coupled based on ContentTypes, making it very hard to have URL bundles be an array rather than a key-value based object where the key is the ContentType.

If you could point me in the right direction, I'd love to give it another go, but at this moment, the plugin doesn't meet our requirements.

Namstel commented 9 months ago

I hate to be a nag, but are there any updates on this?

MSACC commented 9 months ago

For our interest: Is this a feature you would pay for? We can then maybe give this priority on our roadmap.

Namstel commented 9 months ago

That would then be something I'd have to pay out of my own pocket, which I'm willing to do, but it's not going to be hundreds of dollars.

TMSchipper commented 9 months ago

@Namstel Hi, I have created a ticket for our scrum board so that this issue gets a higher priority. We are busy with a project related with Strapi so that the issue/bug process will be a lot faster in the future. We are also still expanding and maintaining our plugins. You will hear from us as soon as we have something ready for this issue, I hope to have informed you sufficiently. Kind regards, Tim Schipper.

ilnytskyi commented 8 months ago

I have an use case where I have a complex content type. And based on different columns I can have listing pages or single item pages.

Let's say

/item/[id]
/items/[city]
/items/[city]/[other_filter_param]

So I have all items in the city, single item or items in the city limited by param. Depending of combination each page can have its own unique content.

I'd even suggest that we do not have multiple sitemaps for same content type but rather multiple sitemaps based on custom filters. Same map can include one or several content types.

e.g. separate map for products and product images can be generated from same content type.

All maps together can work as composite sitemap.

At some point it can get to complex Feeds generator plugin. But by limiting the scope to just sitemaps it should be possible to create them in a more flexible way.

my json suggestion

"sitemaps": {
    "some_sitemap": {
      "contentTypes": [
        {
          "type": "api::type.type",
          "languages": {
            "und": {
              "pattern": "/en/[city]/[other_filter_param]",
              "changefreq": "daily"
            }
          }
        },
        {
          ...same type with different filters or different content type
        }
        ]
      }
  },

for now the workaround is to either hook into plugin or decompose entity into different content types

egekaanisik commented 5 months ago

Hi, is there an update on this? We need this feature on our project. Best wishes.

TMSchipper commented 5 months ago

Hi @egekaanisik @Namstel and others, sorry if we are a little late in updating you with the current status.. We hear your requests about this feature and have now placed this issue in our sprint backlog, which will be included in the next sprint. We are first going on holiday to take some rest and as soon as we return (July 1, 2024) we will pick up this issue and actively update you regarding the status.

If you have other small wishes (not out of scope) that could be taken into account during the development of this feature, we would love to hear from you!

Regards, PluginPal

egekaanisik commented 5 months ago

Thanks for informing. I saw that there is a pull request for filtering entries based on custom filters. Adding multiple entries based on filters can bu useful. For example, we have a field for Link of a product and some attributes for specs. Some pages should be added based on if the value is null or not.

Example usage: /product/[product link] ---> for the product itself /product/[product link]/specs ---> this page should be added to the sitemap based on an attribute being null or not

egekaanisik commented 4 months ago

Hi, any updates on the matter?

TMSchipper commented 4 months ago

Hi @egekaanisik, the development for this issue is starting coming Monday.

Regards, PluginPal

TMSchipper commented 4 months ago

Good evening all, I just started working on this feature but then I found out there is a critical bug that needs to be solved first before I can continuing on this feature. Issue-150 When this is done I can continue with this feature. Hopefully I've informed you guys enough and we are working hard to resolve to your feature. If you guys have any questions or remarks you can always hit us up.

Kind regards, PluginPal.

spalz commented 3 months ago

First of all, thank you very much for this fantastic plugin.

I am eagerly anticipating the new feature. In my projects, I use quite specific logic for content translation. For things like "Blog", I use the standard Strapi translation plugin.

However, there are other items such as "Categories" or "Countries" which are relatively simple data collections. For these, creating separate entries for each language requires more thorough validation. In my latest project, there are at least 5 collections created without translation but with mandatory fields like "titleen" and "titlede". The ability to duplicate the "URL bundle" would solve this problem.

double

Which would ultimately result in the output of the same collection but with a different pattern.

output

spalz commented 3 months ago

Hi, is there any news on this issue?

boazpoolman commented 3 months ago

We're currently working on this feature. It's aimed to be finished by the end of the month.

Probably the biggest news: This feature will be added to the Webtools Sitemap addon.

It's essentially a copy of the standalone sitemap plugin, meaning you'll have all the features you're used to. The only difference is that the core Webtools plugin will handle all the URL pattern stuff, as well as a offer new features like URL management and a front-end router API.

Even though the Webtools plugin is officially still in beta, we're getting close to a stable release. In the mean time we will keep fixing bugs for the standalone sitemap plugin, but any new features will be added to Webtools, eventually deprecating the standalone plugin once we've published the stable release of Webtools.

spalz commented 3 months ago

@boazpoolman Thank you for your response. I have already tried installing the "Webtools Sitemap add-on," but I encountered various errors, which have been mentioned in other issues. I will wait for a stable version.

boazpoolman commented 3 months ago

Could you reference those issues?

TMSchipper commented 2 months ago

Hey guys, short update. We are around 65% of the feature and we are adding the final parts for this expansion. We will keep you guys updated with our progression.

Screenshot 2024-09-01 at 12 38 31

Kind regards, PluginPal.

TMSchipper commented 2 months ago

Good evening guys, we haven't forgotten you ;). We are almost there and have added the last bit to our extension but we still want to think about it for a moment if everything is correct and if nothing is missing. You will also receive a "set as primary" field per url pattern in a moment to have more control over the patterns. If you want to add something, we are of course open to that.

Screenshot 2024-09-16 at 21 51 34

Screenshot 2024-09-16 at 21 56 55

Kind regards, PluginPal.

egekaanisik commented 2 months ago

Hi,

Thanks for your effort! Is there any option to add the URL alias based on a condition?

boazpoolman commented 2 months ago

Hi @egekaanisik,

Not as of yet. But this is somewhat described in this feature request: https://github.com/pluginpal/strapi-plugin-sitemap/issues/165

We will eventually allow extension points where you can alter the sitemap, or other Webtools APIs, to exclude/include certain URLs using custom logic that you write in your own application.