Document
- 1. Blogger 閱
原本沒有「繼續 讀」,也就是文章展開和收合的功能。所幸網路上總是有了不起的人為大家撰寫免費程式碼,
彌補 Blogger 的缺點。雖然不同 template 有不同的做法,而且無法通用,不過我最後也找到了適合我的 Template 使用
閱
的「繼續 讀」功能。
做法是先進入編輯 html 區,勾選「Expand widget templates」,然後在標籤<head>之後插入下列 Java 程式碼:
<script type=quot;text/Javascriptquot;>
function hidePost(postUrl)
{
var label=document.getElementById(quot;fullpostquot;);
if(label!=null){
eA = document.createElement(quot;aquot;);
eA.setAttribute(quot;hrefquot;,postUrl);
eA.setAttribute(quot;titlequot;,quot;Read Morequot;);
eA.appendChild(document.createTextNode(quot;...Read Morequot;));
eB = document.createElement(quot;pquot;);
eB.setAttribute(quot;idquot;,quot;read-morequot;);
eB.appendChild(eA);
label.parentNode.appendChild(eB);
label.parentNode.removeChild(label);}
}
</script>
其中藍色的「Read More」字樣可自行修改。
接著,再找到 <p><data:post.body/></p>,用下面的程式碼取代它:
<p><data:post.body/></p>
<b:if cond='data:blog.pageType != quot;itemquot;'>
<b:if cond='data:post.url'>
<script type='text/javascript'>hidePost('<data:post.url/>');</script>
</b:if>
</b:if>
內
記得儲存上述變更。之後,只要在張貼文章時,輸入<div id=quot;fullpostquot;> </div>程式碼,將要隱藏的部份 容置於兩個標
內 閱
籤之間,即<div id=quot;fullpostquot;>要隱藏的 容</div>,便能完成「繼續 讀」的功能。