Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Twig help

Started by Muut Archive 10 years ago · 2 replies · 662 views
10 years ago

Hi Everyone!

I really stuck in an if parameter I'll basically want to code on twig {% if in page.header ( in front matter) has got any title: > print on screen the title and if not > do nothing and pass the code...

there are lots of things like that in coding on my website so I really learn to understand the parameters working Could anyone help me to figure it out please.. thanks and keep up good work.

10 years ago

I'm no twig expert but I think there are 2 ways you could do this depending on your setup.
Using this method would only display if the field {{ page.header.title }} exists in your frontmatter.

TXT

Or to check if the field is empty or not something like this

TXT

Suggested topics

Topic Participants Replies Views Activity
Archive · by Muut Archive, 10 years ago
1 672 1 week ago
Archive · by Deleted User, 9 years ago
0 3042 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5336 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago