We're building a website for a company with multiple locations which need different content but based on the same templates.

I currently have a section Locations. What I want to achieve is to structure the URL's as follows:

  • mywebsite.com/fr/brussels/park
  • mywebsite.com/fr/new-york/park

How can I achieve this result?

I have found a similar question from 2015 but this might be outdated: Show content based on chosen city

1 Answer 1


I'm assuming /fr/ is for language and /park/ is the slug of the Locations entry? Is /brussels/ also the slug for another entry, or is it just a key you're using to determine what content to show on the Park page?

In config/routes.php you can set up a route for the French site like this:

return [
  'fr' => [
    <citySlug>/<entrySlug:{slug}>' => ['template' => '_location']

And then in the _location.twig template, you'll be able to access citySlug variable (e.g. 'new-york'). You could then use that to find and display the relevant content. How you do that will depend on whether that content lives on the Park entry, or if you have to query some other entry for it.

Just note that because there's no static base URL segment here (e.g. /fr/locations/new-york/park/) you might have to do some additional logic to make sure the route doesn't unintentionally affect other sections.

EDIT: I may have misunderstood the intent here. Is this just entries in the locations section that have slightly different content based on the city? Or is it more like each city has totally different content for the same (or a similar) set of entries? You may actually just want to create multiple sites (one for each language/city combo) instead of doing the above.

  • /fr is indeed for language, /brussels is the location, and /park is the name of the page. This could just as well be /about. There is a park in Brussels and a park in New York. This should use the same template but have different content. Each city will have different content like attractions and other accommodations. Multiple sites might be the correct approach here actually. I just need to make sure it still is easily manageable for the client.
    – Matthias
    Sep 18, 2023 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.