Dynamic slugs with multiple segments naming and leaf segments issue #346
Unanswered
MikeDrenth
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
i am reaching out because i am in the need of some advice on a working project. This is based on the platformer kit that you all build in V12 before. Where we have a multi tenant project.
Now we have a folder [site] that holds the name of the website. That we need to get the correct data for the matching website, and then we have a folder [...slug] that we need to get the correct data for the current visited page.
Lets say our client has multiple locations and every location can have their own news items. That means that we could have a slug that would be '/rotterdam/news' and '/amsterdam/news' (they can name their page urls like this if they want) could even go a bith further with '/netherlands/amsterdam/news' etc.
This means that we would need '/amsterdam/news' as slug to fetch that current page their data. [...slug] returns a array, which is fine we can work with that for now. But now get the issue at the following moment.
Whenever you click on the detail page of that news item, the slug would become '/amsterdam/news/news-title-items-1 (the last part would be the name of the news item)
This means the slug becomes '/amsterdam/news/news-title-item-1', but since we are fetching the current page data, we cannot use the last part where we hold the news item's name.
Now we are kinda stuck because we don't really know how to solve this problem. '/amsterdam/news' should be the slug, 'news-title-item-1' should be another slug
I hope that i described the issue good enough, and hope that someone can help us how we can get a workaround for this. We are not able to create folder that holds a static name, because every client can name their pages whatever they want.
We tried a bit with generateStaticParams, where we would generate the list of all the possible URLs that where made by the client, but this didn't work out for us too badly.
Beta Was this translation helpful? Give feedback.
All reactions