Panel Configuration
Configure the Kirby Panel for headless usage.
Preview URL to the Frontend
If you are running a headless CMS, the default preview links from the Kirby Panel won't make much sense because they point to the backend URL. We need to change the hostname of the generated preview URLs to the frontend URL. To do this, set the preview
option in your template to a Kirby query that calls the frontendUrl
page method provided by this plugin:
site/blueprints/pages/default.yml
options:
# Or `site.frontendUrl` for the `site.yml`
preview: "{{ page.frontendUrl }}"
Finally, set the frontendUrl
option in your config.php
:
config.php
return [
'headless' => [
'panel' => [
'frontendUrl' => 'https://example.com'
]
]
];
If the value is empty, the preview button will be disabled altogether.
Redirect to the Panel
If your Kirby project is headless only and no visual content is served, you may want to redirect editors to the Panel when they visit the backend. You could create a default template with a redirect, but it's easier to set the redirect
option in your config.php
:
config.php
return [
'headless' => [
'panel' => [
'redirect' => true
]
]
];