次のコードを入力します。
<b:if cond='data:blog.pageType == "item"'>
<span id="last-modified"><!-- ここに表示される --></span>
<script type="text/javascript">
// <![CDATA[
function show_last_modified(root) {
var published="";
var updated="";
for (var i = 0; i < root.feed.entry.length; i++) {
published = root.feed.entry[i].published.$t;
updated= root.feed.entry[i].updated.$t;
}
var dd_Y = updated.substring(0,4);
var dd_M = updated.substring(5,7);
var dd_D = updated.substring(8,10);
var pp_Y = published.substring(0,4);
var pp_M = published.substring(5,7);
var pp_D = published.substring(8,10);
if(dd_Y == pp_Y && dd_M == pp_M && dd_D == pp_D){
//日付が同じときは出力しない
}else{
var updated_dd ="最終更新日:"+ dd_Y+"/"+dd_M+"/"+dd_D+"";
document.getElementById("last-modified").innerHTML = updated_dd;
}
}
//]]>
</script>
<script type='text/javascript'>
var sHome="<data:blog.homepageUrl/>";
var sURL="<data:post.url/>";
sURL = sURL.replace(sHome, "");
sURL = "/" + sURL;
document.write(unescape("%3Cscript")+" src='"+sHome+"/atom.xml?redirect=false&path="+sURL+"&max-results=1&alt=json-in-script&callback=show_last_modified' type='text/javascript'"+unescape("%3E%3C/script%3E"));
</script>
</b:if>
</span>
体裁を合わせるため<i aria-hidden='true' class='fa fa-clock-o'/>の後ろに公開日と入力。
<b:else/>
<!--記事ページの時-->
<div class='post-body entry-content' expr:id='"post-body-" + data:post.id' itemprop='articleBody'>
<div class='top-meta'>
<p class='kousin'>
<span class='post-timestamp'>
<i aria-hidden='true' class='fa fa-clock-o'/>公開日
<b:if cond='data:post.dateHeader'>
<script type='text/javascript'>var hiduke = "<data:post.dateHeader/>"</script>
</b:if>
<b:if cond='data:top.showTimestamp'>
<b:if cond='data:post.url'>
<meta expr:content='data:post.canonicalUrl' itemprop='url'/>
<abbr class='published' expr:title='data:post.timestampISO8601' itemprop='datePublished'><script type='text/javascript'>document.write(hiduke)</script></abbr>
</b:if>
</b:if>
</span>
ここに挿入
<span class='post-tag'>
<参考サイト>
Bloggerで記事に最終更新日を付ける方法