Cookbook
Recipes and solutions to common problems for Grav 2.0 and Admin2. Please feel free to edit these pages and add your own.
Cookbook
This chapter collects practical, problem-and-solution recipes for Grav 2.0 and the Admin2 interface. Each recipe states a problem and walks through a working solution you can adapt.
Recipes here target the current generation of Grav: the REST API, the Admin2 SPA, and the plugin integration events. For recipes that rely on the legacy admin-classic interface, see the Grav 1.7 Cookbook.
General Recipes
General Recipes This page contains an assortment of problems and their respective solutions related to Grav in general. Change the PHP CLI version Sometimes on the terminal, the PHP version is different than the PHP version used by the web server. You can check the PHP version running in the...
Twig Recipes
Twig Recipes This page contains an assortment of problems and their respective solutions related to Twig templating. List the last 5 recent blog posts Problem: You want to display the last 5 blog posts in a sidebar of your site so a reader can see recent blog activity. Solution: Simply f...
Plugin Recipes
Plugin Recipes This page contains an assortment of problems and their respective solutions related to Grav plugins. Output some PHP code result in a Twig template Goal: You want to process some custom PHP code, and make the result available in a page. Solution: You create a new plugin th...
Admin Recipes
Admin Recipes This page collects problems and solutions related to customizing the Admin2 interface. Admin2 is the SvelteKit single-page app that talks to your site through the REST API; plugins extend it by subscribing to onApi* events and, where needed, shipping small web components. For the...
Tutorials
This section is dedicated to providing tutorials you can follow to achieve some common scenarios. Please feel free to edit these pages and add your own.