How does nested routing/pages work with Strapi?

Hi, Strapi newbie here once again. I am building my first corporate website with strapi. I am wondering what the best practice for nested routes/pages is.
I basically want to have a url like this → e.g. mydomain.com/company/about/founding.

The way i currently handle these routes is like this:
I create pages with unique slugs like “company”, “about” and “founding”. In my NextJS frontend, i take the last part of current url (in this example “founding”) and then query the api with the “slug=founding” filter. So I am ignoring all the other nested parts of the url.

But with this method, somethig like this is not possible:
mydomain.com/company/about/founding
mydomain.com/another/page/founding.
since the slug is unique.

Yes, i could enter the the whole route in the slug field, but I feel like it is not the optimal way to configure the routes. As far as i know, something like directly nesting the pages in Strapi is not possible. But i am wondering how big sites manage the routing and pathing. Does anyone have insights about this?

Any help is appreciated again. Thanks.

This topic has been created from a Discord post (1231963307003478036) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

We don’t currently support nested content-type routes like that. You can nest some actions but it requires some careful considerations to not break existing routes.

Also you are thinking of API routes like website routes not in a headless CMS way. You’ll almost never have frontend page routing that matches the API routing especially in a headless CMS.

I’m evaluating Strapi for a pretty large site and can’t seem to find a good answer for this. Most of the content team is non-technical, so a good UX here is critical.

I know this has been discussed a few times (like here), and that this an old thread, but I’d like to interrogate this a little. I’ve read how I might be able to solve the slug problem thanks to this guide) and recognize you can handle the parent/child data modeling using a relation field.

While I understand how I can get this to work when querying from the frontend, I still find it difficult to understand the relationship of content from the “list view” in the Strapi admin.

Taking some concepts from the issue linked above, Wordpress, for example, displays parent/child relationships right in the list view (image attached). This makes it easy to see the relationship of content from a top level view and make adjustments informed by that structure. Being able to modify that structure directly from the list view (via “Quick Edit”) is also much easier and makes a lot of sense in that context.

All that to say, I do think there is some value to being able to control the slug structure from the CMS by using parent/child relationships. I understand that the routing won’t always match 1:1, but IME non-developers are the ones who tend to control the site structure and rely on that control for things like logically grouping content and SEO.

Curious if there are any suggestions or examples of how folks with large sites have approached this. Thanks!

I am currently developing a plugin that is a combination of the Webtool plugin and the Navigation plugin. I make this for my needs and maybe someone will find it also helpful. I hope the first version will be ready in a few weeks.

As of right now, you would need to add an entity to a navigation in order to get the “nested structure” URL alias. But I have an idea how I could implement a generel nested structure for all entities into the plugin.

Curious about the plugin you’re building, is it on Github?

I’m the creator and maintainer of Webtools, which tries to fill this gap of server side URL management.

Hi <@344388867446669315>, it is on GitHub, but currently as a private repository until a v1 is ready. Then I’m going to make it public.