0

I need to create custom module routes like the following.

  • /ireland-dummy-page (IE)
  • /uk-dummy-page (UK)
  • /dummy-page (global)

How can I write the route paths for this scenario? Do I want to write separate ones or is there any way to make this dynamic?

my.calculator:
  path: "/{con}-dummy-page"
  defaults:
    _controller: '\Drupal\calculator\Controller\CalculatorController::CalculatorPage'
    _title: "Dummy test page"
  requirements:
    _permission: "access content"
  options:
    no_cache: "TRUE"
2
0

In your edit, {con} is a route parameter? This is not possible in Drupal, you can't start with a route parameter and /{con}/ has to fill an entire route segment.

Before you can match a route for such a path you have to do some path processing. See Do new routes require a static first portion?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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