I use Google Sites with my students and have embedded resources, forms, docs etc. that I link to from Classroom so I wanted to embed one of these Share buttons. Adding script to GSites pages is a little tricky but with a little bit of Apps Script it can work!
In the image above, I have added the share button beside the page title; this is done by creating and inserting an Apps Script that has been published as a web app.
I want to be able to copy a page with the script already in it and have it automagically pull the correct URL from the Site without hard coding the URL each time. The scriptlet code above allows this by using SitesApp.getActivePage().getUrl();
Publish the project as a Web App and insert it into your page:
When pressed, the button opens a window to Classroom and lets you select the class you want to post an announcement or assignment to. Nice :)