參考網址:
增加文章更新時間 (Show Post Update Time) ↗
下載網頁:「增加文章更新時間」的語法 ↗
打開管理介面、版面配置、修改 HTML 樣板原始碼(一樣要展開小程式範本),在程式碼 <head> 區段內(</b:skin> 標籤後、</head> 標籤前),塞入 Javascript 程式:
<script type='text/javascript'>
//<![CDATA[
<!-- Function used for generating the last update time for each post: showPostUpdateTime() -->
function showPostUpdateTime(json) {
var updateTime = json.entry.updated.$t;
var publishTime = json.entry.published.$t;
if (updateTime.substr(0,10) != publishTime.substr(0,10))
document.write(' | 更新於 '+updateTime.substr(0,10)+' '+updateTime.substr(11,5));
}
//]]>
</script>
從這個範例來看,把最後更新時間放在「發表時間」的後面,而且,只有在顯示該篇文章全文的時候,才會顯示出來(所以首頁看不到,判斷規則可以參考這篇文章)。所以先找到顯示發表時間 (<data:post.timestamp/>) 的區段,在它的下方一行,插入紅色的那個程式:
<!-- Fixed for display post update time -->
<b:if cond='data:blog.pageType == "item"'>
<script expr:src='"/feeds/posts/default/" + data:post.id + "?alt=json-in-script&callback=showPostUpdateTime"' type='text/javascript'/>
</b:if>
網頁:
參考資料 ↗