Cookbook
This chapter is dedicated to providing recipes and solutions to common problems. Please feel free to edit these pages and add your own.
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 contains an assortment of problems and their respective solutions related to Grav Admin modifications.
Add a custom YAML file
Problem:
You want to provide a site-wide group of user-editable company fields akin to system.yaml or site.yaml, but in its own dedicated...
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.