How to get the panel edit page subpage url?


I have built a front-end private backend in which a connected user can see some sub-pages.
I would like to allow the admin user to click on a sub-pages title to open and edit it in the kirby panel.

What is the easy way to generate the subpages link to open it in the edit panel page?

Something like:

<a href="">subpages title</a>

I suppose something like this could do the job:

<a href="<?= $site->url() ?>/panel/pages/<?= $page->find('subpage-uri')->uid() ?>/edit">subpages title</a>

… but some part of this url is hardcoded (/panel/pages/ & /edit). Is there a Kirby function to get this panel url ?

There’s the purl() helper function but it’s only available when the panel is loaded. Wouldn’t work in your case.

I would create a custom page method based on the purl() code. This way it could be used like so:


Thanks @pedroborges for your advices. I will check how to create a custom page method out :slight_smile:


You can look at or the whole solution on that page. The pictures there are from the old Starterkit!

May be, you have to adjust my code to your needs.

Good luck!