【问题标题】:Google Sites: Insert date published for pages within a siteGoogle 协作平台:插入网站内页面的发布日期
【发布时间】:2012-12-22 13:29:09
【问题描述】:
我是 Google 协作平台的新手,我想知道如何为站点内的页面插入发布日期和最后更新日期(不使用博客模板)。
看来我可以同时使用 Apps 脚本
utilities.formatDate(SitesApp.getActivePage().getDatePublished(), "GMT", "d-MMM-yyyy")
和
ContentService
但我不确定如何实现它。
【问题讨论】:
标签:
google-apps-script
google-sites
【解决方案1】:
您可以使用以下代码在您的 Google 网站上显示上次更新和发布日期。您可以使用此代码创建一个 Apps 脚本小工具,然后您可以将其嵌入 Google 网站。
function doGet(e){
var app= UiApp.createApplication();
var page = SitesApp.getActivePage();
app.add(app.createHTML('Last updated: ' + page.getLastUpdated()));
app.add(app.createHTML('Published: '+page.getDatePublished()));
return app;
}
你可以看一个演示here
有关 Google 网站中的小工具的更多信息,请访问 this page