#Nested Slug handling in payload

5 messages · Page 1 of 1 (latest)

junior fjord
#

Hey, A simple setup doubt, would be glad to hear the input from anyone.

So i had setup payload cms with my website and its been working fine so far.
I have till now created something like website-url/[slug_1]/[slug_2] so for slug_1 i created a collection called Pages in which i am adding all the first slugs of the pages it will be redirected to, and for slug_2 i have created a payload collection called [Slug_1] in which i can add as many slugs inside which will act like slug_2 but, what if i want [slug_3] after the slug_2. What is the best possible way i can handle this both from payload admin point of view and from writing the code for it point of view ?

This would be really helpful for me and for my website

noble meadow
#

https://github.com/bold-media/payload-starter You can check out this repo to see how I prefer to do nested routes.

I put it all in the same collection and query by pathname, instead of slug.

Do note that the starter is a work in progress, though based off of the Payload website template, it is not fjnished yet and I recommend testing anything before assuming it works.

junior fjord
#

And also if i end up putting all in the same collection, it might look messy for whoever is handling the Payload admin side in our company.
So is there any way i can sort this out in the best possible way?

Or do you think this is the best possible way for both admin side and development side?