Html helper link doesn't respect custom route

Hi, I needed to change the path for an entity and thought I could just make a custom route rule without renaming the original database table.

So I added the ‘ExternalItems’ line to my routes.php:

$routes->scope('/', function (RouteBuilder $builder): void {

        $builder->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);

        /*
         * ...and connect the rest of 'Pages' controller's URLs.
         */
        $builder->connect('/pages/*', 'Pages::display');

        $builder->resources('ExternalItems', ['path' => 'external-references']);
        /*
         * Connect catchall routes for all controllers.
         *
         * The `fallbacks` method is a shortcut for
         *
         * ```
         * $builder->connect('/{controller}', ['action' => 'index']);
         * $builder->connect('/{controller}/{action}/*', []);
         * ```
         *
         * You can remove these routes once you've connected the
         * routes you want in your application.
         */
        $builder->fallbacks();
    });

Now, if I use the HTML helper for making a link, with action=‘view’, I get a link with the new url, external-references. However, an HTML helper link with action=‘edit’ generates a link with the old path in the url, external-items.

Examples:

<?= $this->Html->link(__('View External Reference'), ['controller' => 'ExternalItems', 'action' => 'view', $externalItem->id], ['class' => 'btn btn-sm btn-outline-dark edit-entity-button']) ?>

<?= $this->Html->link(__('Edit External Reference'), ['controller' => 'ExternalItems', 'action' => 'edit', $externalItem->id], ['class' => 'btn btn-sm btn-primary edit-entity-button']) ?>

The first one respects the new route, the second one doesn’t. Am I missing a trick somewhere?
Thanks.

EDIT: I see now that urls with the new path and an action don’t work. E.g. mywebsite/external-references/edit/999 looks for the non existent controller ExternalReferences.
Though mywebsite/external-references/999 works for a view and the index page works: mywebsite/external-references.
I guess I need to add more comprehensive rules to the router which cover these use cases?

For reference. A few more lines were required to make the links with actions work:

 $routes->scope('/', function (RouteBuilder $builder): void {
        /*
         * Here, we are connecting '/' (base path) to a controller called 'Pages',
         * its action called 'display', and we pass a param to select the view file
         * to use (in this case, templates/Pages/home.php)...
         */
        $builder->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);

        /*
         * ...and connect the rest of 'Pages' controller's URLs.
         */
        $builder->connect('/pages/*', 'Pages::display');

        $builder->resources('ExternalItems', ['path' => 'external-references']);
        $builder->connect('/external-references/{id}', ['controller' => 'ExternalItems', 'action' => 'view']);
        $builder->connect('/external-references/edit/{id}', ['controller' => 'ExternalItems', 'action' => 'edit'])
            ->setPatterns(['id' => '\d+'])
            ->setPass(['id']);;
        $builder->connect('/external-references/view/{id}', ['controller' => 'ExternalItems', 'action' => 'view'])
            ->setPatterns(['id' => '\d+'])
            ->setPass(['id']);;
        $builder->connect('/external-references/add', ['controller' => 'ExternalItems', 'action' => 'add']);

        /*
         * Connect catchall routes for all controllers.
         *
         * The `fallbacks` method is a shortcut for
         *
         * ```
         * $builder->connect('/{controller}', ['action' => 'index']);
         * $builder->connect('/{controller}/{action}/*', []);
         * ```
         *
         * You can remove these routes once you've connected the
         * routes you want in your application.
         */
        $builder->fallbacks();
    });