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.

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 · 993 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 Jerry Hunt, 4 days ago
2 74 6 hours ago
General · by pamtbaau, 12 hours ago
1 47 11 hours ago
General · by Andy Miller, 24 hours ago
0 44 24 hours ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 39 5 days ago