Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Twig in user page

Started by Muut Archive 11 years ago · 5 replies · 262 views
11 years ago

Hello,

If I understood correctly, I can use twig in my user pages as long as I declare twig as activated in the system.yaml.

theme: antimatter
markdown_extra: false
process:
markdown: true
twig: true

Once it's activated, I have inserted a twig line in one of my page:

How to find us?
{{ gmaps({'id': 'gmaps', 'class': 'gmaps'}) }}

But the result page shows the row twig line, and not the Google Maps.
Did I miss something?

Thanks for any help you could provide me with.

11 years ago

should be:

YAML
process:
    markdown: true
    twig: true

That with the plugin enabled should do it. You can test by putting this in your content:

TWIG
page title: {{ page.title() }}

If that displays the title correctly, twig is running fine, and it must be an issue with the plugin somehow (perhaps needs to be activated on the page). So read the plugin README.md file for more details on that.

11 years ago

Hi,

thanks for the help.
So it seems that twig is not running fine on my configuration.

In my system.yaml, I have:

YAML

pages:
  theme: antimatter
  markdown_extra: false
  process:
    markdown: true
    twig: true

(...)

twig:
  cache: true
  debug: true
  auto_reload: true
  autoescape: false
--- 

I have switched twig: false to twig: true (in pages>process). Do I need to set anything else?
11 years ago

if you have it in your system.yaml then it's enabled site-wide. I like to have it off in system.yaml, and just add it in the pages header where I need it. This saves every page from being processed for twig when they probably don't need it.

11 years ago

Hello,

thanks for your answer.
I cannot figure out why it doesn't work when I set it in the system.yaml.
Yet, I've set it in the page where I need it:

YAML
title: Access
menu: Access
image_align: right
process:
  twig: true

and it just works fine! Thanks.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1336 9 years ago
Archive · by Muut Archive, 9 years ago
2 925 9 years ago
Archive · by Muut Archive, 9 years ago
2 4056 9 years ago
Archive · by Muut Archive, 9 years ago
1 2941 9 years ago
Archive · by Muut Archive, 9 years ago
3 1112 9 years ago