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

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 · 1078 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 ian russell, 5 days ago
2 129 4 days ago
General · by pamtbaau, 1 month ago
2 380 1 week ago
General · by Hanns Mattes, 1 month ago
2 360 2 weeks ago
General · by Andy Miller, 1 month ago
0 263 1 month ago
General · by Jerry Hunt, 1 month ago
2 402 1 month ago