A simple shortcut to open a page in Kirby Panel
24.01.2025
I use the Kirby CMS for my website. When editing the content, you have to switch regularly from the frontend to the panel to edit the page that has just been called up. A possible solution for this is to use the Admin Bar plugin. However, this was not necessary for my purposes. Since I work a lot with the keyboard, I just wanted a simple shortcut.
To achieve this, I placed a link on the page and added the accesskey attribute. This allows an element to be provided with a keyboard shortcut.
<?php if ($kirby->user()): ?>
<a href="<?= $page->panel()->url() ?>" target="_blank" accesskey="p">EDIT</a>
<?php endif ?>
In this way the link is only displayed to logged-in users and can be fired with a key combination. In my case with ⌃ + ⌥ + p
– but this depends on the browser and operating system. MDN has an overview of the differences between various browsers.
Sources
- accesskey (MDN)
- panel page method (Kirby Reference)
Kirby PHP
What do you think?
Let's discuss on Mastodon