strapi-plugin-sitemap icon indicating copy to clipboard operation
strapi-plugin-sitemap copied to clipboard

Relational URL pattern

Open boazpoolman opened this issue 3 years ago • 4 comments

Feature request

Summary

Allow querying relational fields in the URL pattern like /prefix/[relation.slug_field].

Why is it needed?

For better dynamic URL patterns.

Related issue(s)/PR(s)

#75

boazpoolman avatar May 06 '22 15:05 boazpoolman

Is it possible to make the population of relational fields recursive for example /prefix/[relation.relation.slug_field]/[relation.slug_field]/[slug_field].

Also a feature for making deeply nested routes would be cool, such as /prefix/[relation.slug_field*]/[slug_field], which would probably also require recusively populating fields.

Thanks for all the hard work you have put into this plugin already!

Alexnortung avatar Jul 22 '22 13:07 Alexnortung

Yeah, making it recursive makes sense to me. Making it possible for you to go infinitely deep with the relation nesting.

Though this syntax I don't get /prefix/[relation.slug_field*]/[slug_field]. What exactly are you querying with the * character?

boazpoolman avatar Jul 22 '22 16:07 boazpoolman

Any updates on this, also can you document this feature ?

quiloos39 avatar Sep 01 '22 11:09 quiloos39

The feature is in beta. You can install it like this:

yarn add strapi-plugin-sitemap@beta or npm install strapi-plugin-sitemap@beta

boazpoolman avatar Sep 01 '22 12:09 boazpoolman

Thank for this feature !

We can't do the same with a component relation ?

thibaultcarlier avatar Nov 09 '22 12:11 thibaultcarlier

@boazpoolman I just realised this must be what @thibaultcarlier must have meant from that comment.

I assumed they meant a component inside of a relation.

Right now if you have a Component on an object you can't reference any fields inside, essentially only root fields are accessible.

TheRealFlyingCoder avatar Dec 03 '22 09:12 TheRealFlyingCoder

@boazpoolman I just realised this must be what @thibaultcarlier must have meant from that comment.

Yes exactly, and I noticed that you can't make it link to components. But I find it sad :/

thibaultcarlier avatar Dec 05 '22 08:12 thibaultcarlier

Yeah @boazpoolman has suggested this is how it should work, so hopefully we will see an update soon to patch this, as the relation update is still in beta :)

TheRealFlyingCoder avatar Dec 05 '22 08:12 TheRealFlyingCoder

Good news ! Thank for your work !

thibaultcarlier avatar Dec 05 '22 08:12 thibaultcarlier

@boazpoolman Just bumping this, any chance we can see this update move forward for components?

TheRealFlyingCoder avatar Dec 21 '22 08:12 TheRealFlyingCoder

Hey @boazpoolman are you still looking to implement the update here for components?

TheRealFlyingCoder avatar Jan 15 '23 07:01 TheRealFlyingCoder

I have planned to work on the beta in Q2 of this year. I'll be sure to look at the components relations as wel.

Up until that moment you are free to fork the beta branch and work on this yourself.

boazpoolman avatar Jan 15 '23 12:01 boazpoolman

I have planned to work on the beta in Q2 of this year.

Awesome that's what I needed to know, it means i'll have to find an alternative solution in the mean time but that's fine :)

Thanks @boazpoolman !

TheRealFlyingCoder avatar Jan 15 '23 23:01 TheRealFlyingCoder

I've opened a PR (#123) that adds the ability to use component fields in the URL pattern.

boazpoolman avatar Jun 28 '23 19:06 boazpoolman

Legend 👍

TheRealFlyingCoder avatar Jun 28 '23 22:06 TheRealFlyingCoder

This feature has been released with version 3.0.0 of the Sitemap plugin.

You are now able to use relational fields in your URL pattern. Like so: /pages/[category.slug]/[slug]

boazpoolman avatar Jul 06 '23 05:07 boazpoolman