Easy way to get to the panel from any page?

In Kirby v1 you could insert “panel” in the URL to edit the current page.
For example, while viewing “/abc/def”, change the URL to “/panel/abc/def” and it would bring you to that page in the panel.

Is there a way to do this in v2? I tried using a .htaccess rule, but it either goes into a redirect loop or stops the panel from loading correctly.

You need to link to /panel/#/pages/show/abc/def

You could make a snippet like the one below to display an edit link for all logged in panel users.

<?php if ($site->user()): ?>
  <a href="<?php echo $site->url() ?>/panel/#/pages/show/<?php echo $page->uri() ?>">Edit</a>
<?php endif; ?>

Thanks, I’ve actually already done that but it’s not great since it doesn’t work if caching is enabled.
Checking if the cookie exists on the client side works, but seems like a bad way to do it.

Ah, ok. Maybe it’s possible to set up a custom route /admin/, pass the page uri as arguments and then redirect to /panel/#/pages/show …???

Yes that seems to work. I’m using this redirect rule:

RedirectMatch 301 /admin(.*) /panel/#/pages/show/$1

As long as “admin” is not an actual page :smile:

Or look at HowTo: Working with contextual links to the panel

Good luck!

It seems the panel URLs changed since the last posts here. At least the above solutions want work anymore.
I have to use this link to jump to a pages edit panel view:

<?php if ($site->user()): ?>
  <a href="<?php echo $site->url() ?>/panel/pages/<?php echo $page->uri() ?>/edit">[Edit]</a>  
<?php endif; ?>

greetings,
Sven

2 Likes

Yes,

you are right like I have written in the link in my post previous to your post With Kirby version 2.2.x the adress of the panel pages have changed..

Hint:
The hardcopies in my inial post of that solution shows the starterkit version <= 2.3.2.

1 Like