ムーヴァブルタイプをカスタマイズして、この最新のコメントのページではスレッドフロート型掲示板のようにコメントが付いた記事を一番上に表示するようにしてあるのですが、今回はそのカスタマイズ方法を教えちゃいます。
やり方はいたって簡単です。基本的にサイドバーなどで新着コメントにリンクする為の特殊タグにリンクだけでなく本文その他全てを表示するようにしただけですから。
この方法だと記事に最大でコメントをいくつ表示させるかまで設定できるのでコメントばが大量に付いたとしてもページが長くなりすぎないので安心です。
まずはMTの「テンプレート」編集ページで「新しいインデックス・テンプレートを作る」で適当にテンプレートの名前を付けて「テンプレートの中身」に以下の内容を貼り付けてください。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=<$MTPublishCharset$>" /> <title><$MTBlogName encode_html="1"$></title> <link rel="stylesheet" href="<$MTBlogURL$>styles-site.css" type="text/css" /> </head> <body> <div id="container"> <div id="banner"> <h1><a href="<$MTBlogURL$>" accesskey="1"><$MTBlogName encode_html="1"$></a></h1> <h2><$MTBlogDescription$></h2> </div><div id="center">
<div class="content"><h3 id="e">タイトル一覧</h3>
<ol>
<MTEntries recently_commented_on="7" sort_order="ascend">
<li><a href="#a<$MTEntryID pad="1"$>"><$MTEntryTitle$></a> (<MTComments lastn="1"><$MTCommentAuthorLink default_name="無記名" spam_protect="1"$></MTComments>)</li>
</MTEntries>
</ol><MTEntries recently_commented_on="7" sort_order="ascend">
<h3 id="a<$MTEntryID pad="1"$>"><$MTEntryTitle$></h3><$MTEntryBody$>
<MTEntryIfExtended>
<p class="extended"><a href="<$MTEntryPermalink$>#more">続きを読む "<$MTEntryTitle$>"</a></p>
</MTEntryIfExtended><p class="posted">投稿者 <$MTEntryAuthor$> : <$MTEntryDate format="%Y年%m月%d日"$> <$MTEntryDate format="%X"$></p>
<MTComments lastn="10">
<p class="posted"><$MTCommentAuthorLink default_name="匿名さん" spam_protect="1"$> <MTCommentAuthorIdentity> : <$MTCommentDate$></p>
<$MTCommentBody$>
</MTComments>
<MTEntryIfCommentsOpen>
<MTIfCommentsAllowed><a href="<$MTEntryPermalink valid_html="yes"$>">全部読む (<$MTEntryCommentCount$>)</a>
<MTEntryIfAllowPings> <a href="<$MTEntryPermalink archive_type="Individual"$>#trackbacks">トラックバック (<$MTEntryTrackbackCount$>)</a></MTEntryIfAllowPings>
<MTParentCategory> <a href="<$MTEntryLink archive_type="Category"$>"><$MTCategoryLabel$></a></MTParentCategory>
<a href="#e">タイトル一覧▲</a><form method="post" action="<$MTCGIPath$><$MTCommentScript$>">
<input type="hidden" name="static" value="1" /><input type="hidden" name="entry_id" value="<$MTEntryID$>" />
<input type="submit" name="post" value="書き込む" />名前:<input name="author" />URL:<input name="url" /><br />
<textarea name="text" rows="5" cols="60" wrap="OFF"></textarea>
</form></MTIfCommentsAllowed>
</MTEntryIfCommentsOpen>
</MTEntries>
</div>
</div>
<div id="right">
<div class="sidebar">
<h2>最近のエントリー</h2>
<ul>
<MTEntries lastn="10">
<li><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a></li>
</MTEntries>
</ul>
<ul>
<h2>アーカイブ</h2>
<MTArchiveList archive_type="Monthly">
<li><a href="<$MTArchiveLink$>"><$MTArchiveTitle$></a></li>
</MTArchiveList>
</ul>
<div id="powered">
Powered by <a href="">0gx.org</a><br />
</div>
</div>
</div>
<div style="clear: both;"> </div>
</div>
</body>
</html>
これを保存して再構築するだけでエントリーがフロートするページが出来上がっている筈です。
デフォルトではコメントが付いた最新7件の記事に最大10個のコメント載せる」設定になってますが
<MTEntries recently_commented_on="5" sort_order="ascend">
これを二つと
<MTComments lastn="10">
上の部分の数字を書き換えれば好みに合わせて変更できます。
コメント(0)
前後の記事
最近の記事
私は神になりたい