Grav 2.0: Twig in Content and the New Security Sandbox
Grav · June 17, 2026
About this announcement
If you've moved a site to Grav 2.0 and a bit of {{ ... }} you had sitting in a page suddenly shows up as literal text instead of rendering, this post is for you. We changed how Twig runs inside page content in 2.0, and it's the single most common "wait, why did this stop working?" question we're getting. It's a deliberate change, it's a security fix, and I want to walk through what it does, why we did it, and what your options are. The short version: Twig inside your Markdown content is now off by default, and even when you turn it on it runs inside a security sandbox. Templates in your theme and plugins are completely unaffected. The full reference lives on the Learn site at Twig in Content. What Actually Changed In Grav 1.7, if you put {{ ... }} or {% ... %} into a page's Markdown and that page had process.twig: true in its front matter, Grav ran it. No questions asked. That was convenient, and a lot of people leaned on it for things like embedding a comments widget, pulling in a config value, or looping over a collection right inside a page. The problem is that page content is user-authored. Anyone with permission to edit a page could write Twig that did far more than print a date. Twig is a full template language with access to PHP objects, and in 1.7 a page editor could reach into Grav's internals, read configuration that held secrets, touch the filesystem, or in the worst cases get code execution on the server. If you let a junior author or a client edit pages, you were effectively handing them keys they didn't know they had. So in 2.0, two things are true: Twig in content is gated. It will not run unless a site administrator explicitly enables it. When it does run, it runs sandboxed. Only a known-safe allow-list of Twig tags, filters, functions, and object methods is permitted. Anything outside that list is blocked. Important This applies only to Twig authored inside page content. The .html.twig files in your theme and your plugins are trusted code that
Read Full Story