Redirect to new page in panel

Hi,

I’m building an event directory, and in order to improve the performance, I’m nesting the events in folders by year and date (with the current 3300+ events listed under one single page the perfomance is not that good).

I want the editors to be able to create their events on the “events” page via the panel, and then move the event programmatically to the correct folder based on the year and month of the event. I’m using hooks to do this, and so far it’s working well, I only have one problem and I’m stuck:

After moving the event to the correct directory, the panel tries to open the page with the “old” url for the page, and of course it can’t find the page. Is there a way to redirect to the new URL manually on the panel after saving the page? I tried using go() but that doesn’t work.

Thanks!

I, too have struggled with a very similar use case in the past.

This is not currently possible, as there is no “backchannel” from the backend hooks to the Panel frontend. There is no way the Panel can be notified of the changed page location.

There are some changes planned in the Kirby core that may enable this in the future; we had a brief conversation on Discord the other day. I just created a ticket on the feedback platform – please upvote and/or add any additional wishes or ideas you have:

Thanks, @sebastiangreger!
Time to look into other solutions then :smiley:

In the meantime, you have my upvote :slight_smile:

If you need a hacky workaround it might be possible to add a redirect in a custom field.
I did something similar for the Modules plugin by redirecting to the parent page via window.location.href: GitHub - medienbaecker/kirby-redirect

Not sure how (or if at all) it’s possible to add this redirect at the right moment though.

Upvoting the feature request is probably the best idea right now.

1 Like

Thanks, @thguenther! I will give this a try sooon, I’m still a bit stuck trying to figure out how to organize the events page.

Also thanks for your work, I use some of your plugins daily! :slight_smile: