Adding scripts (which aren't in master) in one child page

I’m using a master page which controls bootstrap child pages. I decided to add a form and a map from the blocks library to my “contact me” page. This added some html in the main body of the page, which is OK as it’s all one big editable area, but also a number of scripts at the end. Surprise, surprise, they disappeared following the first update.

Any thoughts on best practice to handle this?

A) Make a div around the scripts in the master, and make it editable, so contacts can add more scripts
B) Put all the possible scripts in the master, and make some optional
C) Something else?

Just typing up this question has suggested to me that the best answer is (A) regardless of how strange it may look to “div” the scripts, but I’d be happy to hear other thoughts.

Thanks in advance

David

OK, I’m replying to my own question here, with an added feature request.

I added an empty div down at the bottom of my master and made it editable. On the child page, after adding block components (map and response form in this case), I copied the new css and scripts to this location, where it doesn’t get wiped out on an update.

While this works, I imagine having the css load late in the game isn’t ideal, and it’s not very intuitive for anyone who may find my code when I’m not around.

Could Pinegrow be changed to recognise this situation and act accordingly during an update? It’s also a pain having to mark metadata as editable (title, description, author etc.) every time a new project is started, I’m thinking that “infrastructure” should be editable in a child by default - i.e created according to the master initially, and then left alone, with an option to regenerate (which is where it gets complicated!)

Thanks

1 Like

You’re right, I had to do the same thing and it seems like a hack for something I would assume people want to do all the time. I hope a feature to add meta,script, and divs to a child theme and keep it there is in the works.