Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

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 · 1233 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 Andy Miller, 1 week ago
0 122 1 week ago
General · by lynbor, 1 month ago
3 447 2 weeks ago
General · by lynbor, 3 weeks ago
7 578 2 weeks ago
General · by Harry, 2 weeks ago
0 167 2 weeks ago
General · by Old Man Umby, 1 month ago
2 314 4 weeks ago