For some 5 days I’m messing with Grav, and to my sadness, many themes don’t work, actually almost none.
Late '21 , I scanned all available themes for their compatibility with Grav 1.7.x. All themes created by the Grav team (27) are actively maintained, 64 out of 109 were not compatible.
It sure is a pain for new users, but “Almost none” seems a bit exaggerated…
The incompatibility is due to a breaking change in Twig which started to “autoescape” output as a security measure to prevent code injection. For example:
{% set variable = "<p>Hello World!</p>" %}
{{ variable }}
results in the following HTML being generated: <p>Hello World!</p>
, which is shown as plain <p>Hello World!</p>
in the browser.
There are 2 ways to fix this:
-
This can be mitigated using a Grav config setting in /user/config/system.yaml:
twig: autoescape: false strict_mode: twig_compat: true
Please note, this effectively turns off the security measure.
-
It can also be fixed by editing the theme’s templates and add filter
|raw
to all trusted outputs like{{ page.content|raw }}
. The chances that an abandoned theme will be upgraded and override your changes are slim I guess. But nonetheless…
What I want to say to you all Gavvers, just be honest, Grav is for programmers
I’m not part of the team so I do not know their initial intentions, but speed, flexibility, code simplicity and extensibility for “building” websites was probably a high priority.
Admin was an add-on to ease some tasks for non-developers, but everything and more can be done with the cli and code editor.