0

I would like to display 2 latest news post from my google site's news announcement page. I am using the following codes- index.html

<html>
  <body>
    <div>
<?

 var site = SitesApp.getSite("google.com", "mysite1");

 var page = site.getChildByName("news");
 var announcements = page.getAnnouncements({ start: 0,
                                             max: 2,
                                             includeDrafts: false,
                                             includeDeleted: false
                                              });

 for(var i in announcements) {
   Logger.log(announcements[i].getHtmlContent());
 }

?>
    </div>
  </body>
</html>

script:

function doGet(e) {
  var template = HtmlService.createTemplateFromFile('Index').evaluate();
}

when I am adding this script to my site I am getting the following error. "The script completed but did not return anything."

Please help me to correct the error and if possible a solution. Thank you.

1 Answer 1

0

doGet is not returning anything. Look at the official htmlService help. The samples show you what to return.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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