-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Twig not being processed in page content #1351
Comments
Ok, i looked into this. I setup a fresh installation of the latest RC (should be the same as the stable version). i changed the
then I setup my page with:
The page title displayed just fine as expected. Turning off twig processing in system.yaml caused the twig code to be rendered as expected. Are you sure you set your configuration in |
I think I've found the cause and a fix: Page::content() uses a combination of page configuration and system configuration to decide whether to call Page::processTwig(). Then Twig::processPage() get called which again evaluates the page configuration but forgets to look at the system configuration. I could successfully fix it in v1.1.17 by looking up line 233 in Twig.php:
and then adding an extra line immediately thereafter:
But maybe Twig::processPage() should get rid of |
I still cannot replicate this, can someone provide me steps to replicate the issue?? |
Could you try with a modular page? That's what we have here and that's what looking at the code seems to suggest. |
Ok, found it, replicated it. Discovered the logic was a bit convoluted and in fact it was this convoluted logic that was leading to this issue. Should be sorted now. Please test the commit. |
Tested commit 10a15ef. Works as expected when toggling 'pages.process.twig' between 'true' and 'false'. Thanks and have a great week! |
Using Grav v1.1.17 - Admin v1.2.14
I turned on the setting for processing Twig on pages, in
user/config/system.yaml
:but twig does not get processed if used in the content of a page. Something simple like
{{ config.site.author.email }}
gets outputted raw.The only way to get twig to be processed in a page's content is to add this to the page's frontmatter:
So the system setting is not being used by the pages, it needs to be re-set on a page-by-page basis.
The text was updated successfully, but these errors were encountered: