ブログ改造計画の第二弾のページ分割です。
現在のブログは、Pagenateプラグインを使ってますが、今回はスカイアークさんのPageButeプラグインを使ってみました。
結論から言うと、こっちの方が簡単です。
テンプレートの変更例は、Classic Blogのテンプレートになってます。
1.スカイアークさんのPageButeダウンロードページから、Ver3.5.0をダウンロード。
2.アーカイブを解凍後、PageBute.plを、サーバーのpluginsディレクトリにアップロード。
3.メインインデックステンプレートの変更
青色のタグを追加します。
MTPageContentsタグのモデファイアcountで、1ページに表示する記事数を指定します。モデファイアnavi_countで、ページリンクの数を指定します。例では省略してます。デフォルトでは、11件になります。
MTPageBeforeとMTPageNextタグのモデファイアdelimで、ページリンクの前後ページへのリンク表示を指定します。
・・・前略・・・
<div id="alpha-inner">
<MTPageContents count="10">
<mt:Entries>
<mt:Ignore><!-- Use the Entry Summary module for each entry published on this page --></mt:Ignore>
<$mt:Include module="ブログ記事の概要"$>
<$MTPageSeparator$>
</mt:Entries>
</MTPageContents>
<MTPageEmpty><p>記事は未登録です</p></MTPageEmpty>
<div class="content-nav">
<MTIfPageBefore>
<span><$MTPageBefore delim="<"$></span>
</MTIfPageBefore>
<$MTPageLists$>
<MTIfPageNext>
<span><$MTPageNext delim=">" $></span>
</MTIfPageNext>
</div>
・・・後略・・・
4.月別アーカイブテンプレートの変更
MTEntriesタグのモデファイア「limit="$limit"は削除します。
・・・前略・・・
<div id=" alpha">
<div id="alpha-inner">
<h1 id="page-title" class="archive-title"><$mt:ArchiveTitle$>アーカイブ</h1>
<mt:Ignore><!-- Limit number of entries to the number set in Blog Entry Settings --></mt:Ignore>
<mt:Unless name="datebased_archive"><$mt:Var name="limit" value="auto"$></mt:Unless>
<MTPageContents count="10">
<mt:Entries limit="$limit">
<mt:Ignore><!-- Use the Entry Summary module for each entry published on this page --></mt:Ignore>
<$mt:Include module="ブログ記事の概要"$>
<$MTPageSeparator$>
</mt:Entries>
</MTPageContents>
<MTPageEmpty><p>記事は未登録です</p></MTPageEmpty>
<div class="content-nav">
<MTIfPageBefore>
<span><$MTPageBefore delim="<"$></span>
</MTIfPageBefore>
<$MTPageLists$>
<MTIfPageNext>
<span><$MTPageNext delim=">" $></span>
</MTIfPageNext>
</div>
<div class="content-nav">
・・・後略・・・
5.カテゴリーアーカイブテンプレートの変更
MTEntriesタグのモデファイア「limit="$limit"は削除します。
・・・前略・・・
<mt:Ignore><!-- Limit number of entries to the number set in Blog Entry Settings --></mt:Ignore>
<mt:Unless name="datebased_archive"><$mt:Var name="limit" value="auto"$></mt:Unless>
<MTPageContents count="10">
<mt:Entries limit="$limit">
<mt:Ignore><!-- Use the Entry Summary module for each entry published on this page --></mt:Ignore>
<$mt:Include module="ブログ記事の概要"$>
<$MTPageSeparator$>
</mt:Entries>
</MTPageContents>
<MTPageEmpty><p>記事は未登録です</p></MTPageEmpty>
<div class="content-nav">
<MTIfPageBefore>
<span><$MTPageBefore delim="<"$></span>
</MTIfPageBefore>
<$MTPageLists$>
<MTIfPageNext>
<span><$MTPageNext delim=">" $></span>
</MTIfPageNext>
</div>
<div class="content-nav">
・・・後略・・・
6.ブログの「設定」-「投稿」の”表示される記事数”を"0"にします。
これは、メインインデックスで、全部の記事をページ分割したい場合です。全部の記事が必要なければ、表示したい値にすればOKです。
7.再構築して終了です。