How to trigger a hook via link

I have implemented the plugin “kirby-locked-pages” but I am stuck on a question about hooks.

The plugin contains a hook ‘locked-pages.logout’ which allows to logout again. But I don’t understand how to trigger a kirby hook via a html-link.

For example:

<a click="<?= $kirby->trigger('locked-pages.logout') ?>" href="">Logout</a>

Using this code already triggers the hook on page load.
So how do I trigger the hook after clicking the link?

You cannot trigger a hook via a link, or not directly. The easiest would be a custom route, with a pattern like logout, then inside this route, call
kirby()->trigger('locked-pages.logout'). Not sure why a hook is used.

Thank you for your comment,

I also was asking myself why a hook is used.
I will give it a try with a custom route.

I somehow managed to trigger that hook by creating a new route which I call via link. But somehow I have to click that link twice to call that route.

On first click kirby redirects me to the website’s error page.
Only on second click the route seems to be followed.

Here is my route:

        'pattern' => '/logout/(:all)',
        'language' => '*',
        'action'  => function () {

This is my link:

<a href="logout/">Logout</a>

I surely misunderstand routing but it almost seems to work, so I think this can’t be competely wrong.

And suggestions?

P.S. I contacted the developer of this plugin, unfortunately he doesn’t have time to help.