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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Twig help

Started by Muut Archive 9 years ago · 2 replies · 441 views
9 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.

9 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 Deleted User, 9 years ago
0 1318 9 years ago
Archive · by Muut Archive, 9 years ago
2 915 9 years ago
Archive · by Muut Archive, 9 years ago
2 4044 9 years ago
Archive · by Muut Archive, 9 years ago
1 2920 9 years ago
Archive · by Muut Archive, 9 years ago
3 1104 9 years ago