Definition of dynamic route patterns

I’m wondering if it’s possible to define a route pattern that is build with variables?

I would like to use:
'pattern' => option('news_page_id') . '/(:any)'

…instead of:

'pattern' => 'aktuelles/(:any)',
'language' => '*',
'action'  => function($language, $articleUid) {
  $article = page(option('news_page_id'))->children()->filter(function ($newsPageArticle) {
    return $newsPageArticle->uid() === $articleUid;
  });

  return $article;
}

If you define your routes in a plugin instead of in the config or at least inside the ready option, it will work.

1 Like

Thanks, with your idea I also found the corresponding documentation: