2

I cannot find in documentation an equivalent to getSummary() or getTitle() to retrieve the HTML content of a Google Sites footer (the custom footer editable through Edit site layout > Custom Footer).

getHtmlContent() only provides the content of the main div #sites-canvas-main.

var url = 'https://sites.google.com/a/test.net/';  
var site = SitesApp.getSiteByUrl(url);
var infos = {"title": site.getTitle(), "summary": site.getSummary()};
var page = site.getChildByName("home");
var content = page.getHtmlContent();
  • Do you mean the administrative footer with links like "report this site", or something else? I didn't see any editable footer field on the sites I played with... As a last resort, you can grab any element with UrlFetchApp if the site is publicly accessible. – user79865 Oct 7 '15 at 19:36
  • @MiceElf: The footer my question is referring to is the one editable through Edit site layout > Custom Footer as describe in this documentation. – JV conseil Oct 7 '15 at 22:47
2

One solution using UrlFetchApp:

function GetHtmlFooter() {
  var url = 'https://sites.google.com/a/test.net/'; 
  var content = UrlFetchApp.fetch(url).getContentText("UTF-8");
  var footer = content.match('<div class="sites-subfooter-content"><div dir="ltr">(.*)</div></div></div>')[1];
  return footer;
}
0

At this time there isn't a specific Google Apps Script method to retrieve the site custom footer of a Google Site through Google Apps Script nor through Google Sites API.

Submit a feature request to the Google Apps Script team. To do so,

  1. Go to https://developers.google.com/google-apps/sites/
  2. Click on "Send Feedback"
  3. Click on "Apps Script Product feedback"
  4. Fill up the Google Apps Script Sites feature request form and submit it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.