payload icon indicating copy to clipboard operation
payload copied to clipboard

Nested Docs URL conflicts when using same slug with different parents

Open truthseekers opened this issue 1 year ago • 4 comments

Link to reproduction

No response

Describe the Bug

I am allowed to use the same slug with different parents, but the front end does not pull the correct page when following your nested-docs examples. Creating these parent-child relationships causes problems:

/service-one/ /service-one/location-one /service-two/ /service-two/location-one

Visiting localhost:3001/service-two/location-one displays the /service-one/location-one page.

To Reproduce

Follow these steps to setup payload: https://github.com/payloadcms/payload/tree/main/examples/nested-docs/payload

Follow these steps to setup next with app router: https://github.com/payloadcms/payload/tree/main/examples/nested-docs/next-app

Create parent and child pages with same slug but different parents to experience problem. Example:

/plumbing/ /plumbing/dallas/ /roofing/ /roofing/dallas

And The app will not pull the correct page when trying to visit /roofing/dallas or /plumbing/dallas

Payload Version

"latest" (says 2.4 in node_modules)

Adapters and Plugins

No response

truthseekers avatar Apr 16 '24 18:04 truthseekers

can i work on this issue?

sarfarazsiddiquii avatar Apr 17 '24 13:04 sarfarazsiddiquii

can i work on this issue?

If you are talking to me then absolutely. I don't see why the owner would mind either.

truthseekers avatar Apr 17 '24 20:04 truthseekers

I assigned you @sarfarazsiddiquii so we don't duplicate efforts on our end.

Thanks for offerring you help!

DanRibbens avatar Apr 17 '24 20:04 DanRibbens

@DanRibbens , I've submitted a pull request that addresses this issue. I'd appreciate your feedback and any suggestions for improvement. Thanks!

sarfarazsiddiquii avatar Apr 19 '24 11:04 sarfarazsiddiquii