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 →

Adding body_classes to a twig template

Started by Muut Archive 9 years ago · 1 replies · 1663 views
9 years ago

is it possible to add a body class to a twig template. I would like when a page is created a body class is added to the page automatically then manually adding it.

9 years ago

Generally, use <body id="top" class="{{ page.header.body_classes }}"> in templates to accommodate this. If you want a default set, you'd have to use blueprints to handle that somehow.

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