Txp Plugin: Table of Content
- Posted by Beata on 十一月 9th, 2006 filed in Blog
又是 textpattern 外掛:依照 h1~h6 的內容產生索引。
比較有問題的是同一篇文章內的子標題內容不可重複,不然會跳錯標題。
Download: bat_toc_v0.1.txt
標籤
<txp:bat_toc />
置於文章模型,用來顯示內容索引的。
有四個屬性:listtype:列表樣式。可用 ol 或 ul。預設是 ol。
wraptag:包覆列表的標籤。預設是 div。
class:包覆標籤用的 css class。預設是 bat_toc。
maxlevle:列入索引的最大層級(數字),最高為 6 (因為只有 h1 到 h6)。
<txp:bat_toc_body />
這是用來取代 textpattern 預設的 <txp:body />
用處是替每個 hn 加上錨點,這樣內容索引的連結才找得到標題的位置。
在文章模型裡用此標籤取代 <txp:body />
CSS
.bat_toc ol{margin-left:20px;font-size:11px;}

Leave a Comment