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 →

How to add onload="init();" inside the <body> of a page

Solved by Cameron Limbrick View solution

Started by Cameron Limbrick 3 years ago · 5 replies · 1347 views
3 years ago

Hi! I'm new to grav and am trying to figure out how to add onload="init();" inside the <body> of a page.

<body onload="init();">

thanks for your help!

3 years ago

@cameronl, You should do that inside the Twig template used for the page.

3 years ago

I don't see any twig files in my gantry5 helium template. how do I add to <body> tag in gantry5 template? thanks!

3 years ago Solution

look like I figured it out. Body Attributes in page settings. allows users to customize the attributes for the <body> tag as well as inject content right after <body> opens or right before </body> closes.

3 years ago

@cameronl, Always a good idea to add to the question that you're using Gantry... ;-)
Less then a handful users on this forum use Gantry (and I'm not one of them). It's quite different from how sites are being build with Grav itself.

Gantry has its own forums by the way.

Suggested topics

Topic Participants Replies Views Activity
General · by themetman, 23 hours ago
2 40 16 hours ago
General · by Hanns Mattes, 1 week ago
0 121 1 week ago
General · by Karmalakas, 1 week ago
2 185 1 week ago
General · by Hanns Mattes, 3 weeks ago
0 235 3 weeks ago
General · by Dima, 4 weeks ago
1 211 4 weeks ago