Headless
Getting Started
The Kirby Headless plugin enhances your Kirby site with headless capabilities.
Introduction
This plugin is designed for developers who want to use Kirby's backend to serve content to a frontend application, static site generator, or mobile application. You can either add headless functionality to your existing Kirby site, or use this plugin to build a headless-first CMS from scratch.
Check out to the Kirby Headless Starter repository for a ready-to-use headless-only setup!
Key Features
- ๐งฉ Optional bearer token authentication for KQL and custom API endpoints
- ๐งฑ Resolve fields in blocks: UUIDs to file and page objects or any other field
- โก๏ธ Cached KQL queries
- ๐ Multi-language support for KQL queries
- ๐ต Built-in CORS handling
- ๐ข Express-esque API builder with middleware support
- ๐ Return JSON from templates instead of HTML
Installation
Composer
The recommended way to install the plugin is via Composer. To install the plugin, run the following command in your terminal:
composer require johannschopplich/kirby-headless
Download
Head over to the releases page and download the latest version of the plugin as a ZIP file. Extract the contents of this ZIP file to your site/plugins
folder. It should look like this:
site/plugins/
โโ kirby-headless/
โ โโ โฆ Plugin files
Setup
Nothing to do here! The plugin is ready to use out of the box. If you want to customize the plugin, you can do so by configuring it.
By default, Kirby Headless does not interfere with Kirby's default routing. Thus, it won't affect your existing routes or templates.