Headless Mode
Activating the headless mode turns Automad into a back-end only content management system without a presentation layer that focuses entirely on content creation. While the Dashboard can still be used to manage content, all data and files are made accessible via a read-only JSON API.
The headless mode only has a single template to generate JSON formatted responses. It is possible to create a custom template to replace the default one directly from within the dashboard or with any external text editor. Due to security reasons, a headless template can only be written in Automad's template languange without any PHP.
Custom Templates
The recommended way of creating and editing a custom JSON template is to use the Dashboard as shown in the image above. However, to override the default JSON response template without using the Dashboard, a custom template file named headless.json
has to be created in Automad's config
directory manually. As long as that file exists, it will be used to render the response instead of the default one. It is good practice to copy the default JSON template from /automad/headless/json.php
to /config/headless.json
to get started quickly.
Note that the custom JSON template has the
.json
extension!