Change path of panel Preview button

Is there a way to change the Preview link on the panel?

I am running Kirby on a sub-folder, and this breaks the preview button links.
(mydomain.com/kirby/)

links are:
mydomain.com/kirby/page1

I need them to be
mydomain.com/page1

Kirby is on a sub folder is because is only providing json.

Usually, Kirby detects automatically if it runs in a subfolder. Have you set the RewriteBase in the .htaccess? Another thing you may want to try is to set the URL in your config.php: https://getkirby.com/docs/cheatsheet/options/url.

problem is e.g. mydomain.com/kirby/about is correct, it outputs the about page’s json, but I’d like the preview to link to be the frontend (1 level up, /about), makes sense?

did not edit anything on .htaccess.

this doesn’t seem to change anything:
c::set('url', false);

There isn’t an error here, everything is correct (for a normal use-case), so you don’t need to change the .htaccess or url setting.

The result you want to achieve is currently unfortunately just not possible.
Using Kirby just as a content editing backend and sending JSON to a site that is in the main directory isn’t very elegant in my opinion. Wouldn’t it be better to use Kirby for everything? That will probably be much more stable, easier to maintain and less complex.

Unfortunately, that is not an option for me, I need to run the frontend apart, and Kirby as CMS only.

Is there a way to edit the php that generates the menu?

Sure, you have to change a core file however. The relevant code is in this file. You can change that to remove the subdirectory from the URL.

1 Like

that worked, thanks!

May be https://getkirby.com/docs/panel/blueprints/page-settings can help you, I don’t know you aim.

@anon77445132: This is a special edge case that cannot be handled by page settings; you need to hack the core, as explained above.