Top > MovableType > mt-mostvisited.pl
トップページの右側に人気の記事(TOP10)を表示させてみました。
いい感じです。
■ 必要なものを入手
mt-mostvisited.pl (v1.3)
http://mt-plugins.org/archives/entry/mostvisited.php
Apache::ParseLog (v1.02)
http://search.cpan.org/~akira/Apache-ParseLog-1.02/ParseLog.pm
■ インストール参考ページ
MostVisited 作者のページ
MTで人気記事ランキングを作る
MT Pluginあれこれ - MTMostVisited -
■ Apache::ParseLog 追加
$MT/extlib/Apache 以下に ParseLog.pm を置く。
■ mt-mostvisited.pl の設定
my $logdir = "/path/to/home/log";
my $root = "/weblog/archives";
my $filetype = "html";
my @searchfiles = ("$logdir/httpd-access.log",
"$logdir/httpd-access.log.1",
"$logdir/httpd-access.log.2",
"$logdir/httpd-access.log.3",
"$logdir/httpd-access.log.4",
"$logdir/httpd-access.log.5",
"$logdir/httpd-access.log.6",
"$logdir/httpd-access.log.7");
MT を DBM で使っている場合は
Error in MTMostVisited, while loading EntryID "XXXXXX": This does not appear to be a valid EntryID. It should be all numbers.
のようなエラーが出るようので以下の修正を加える。
--- mt-mostvisited.pl.orig
+++ mt-mostvisited.pl
@@ -128,7 +128,7 @@
#ASSUMPTION: The name of the page is the same as the entry_id.
- my $entry = MT::Entry->load($entryid);
+ my $entry = MT::Entry->load(int $entryid);
#TODO: Need filtering to ensure that it is actually an entry for the current
# blog, but that doesn't seem too critical as different blogs probably
# have different filepaths
■ プラグイン追加
$MT/plugins 以下に mt-mostvisited.pl を置く。
■ テンプレートの編集
ランキング表示用の新しいテンプレートを管理室の「Template の編集」で作成します。
今回は
Template の名前: Popular Ranking
出力ファイル名: ranking.html
「Index Template を Rebuild するときに自動的にこの Template を Rebuild する」のチェックを外す。
で作りました。
テンプレートの内容は
----
<div class="sidetitle">
Popular Entries
</div>
<div class="side">
<MTMostVisited count="10">
<a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a> (<$MTMostVisitedCount$> hits)<br />
</MTMostVisited>
> <$MTDate format="%Y/%m/%d %H:%M"$>
</div>
----
こんな感じ。
■ Main Index の編集
トップページは SSI を使っているので、Main Index のテンプレートで取り込みたい箇所に
<!--#include file="ranking.html"-->
を追加して Main Index をビルドする。
■ cron の設定
0 */1 * * * /path/to/mt-rebuild.pl -mode=index -blog_id=2 -template="Popular Ranking"
Bulkfeeds で関連記事検索
Excerpt: @smate.NET: mt-mostvisited.pl 人気の記事(TOP10)を表示 つけてみましたー。 記事ごとのランキングがわかるの面白いですね。 まぁ、日記なページなので、つけてどうするって感じですがw...
Weblog: はぢめ雑記張
Tracked: February 22, 2004 02:17 AM
Excerpt: @smate.NET: mt-mostvisited.plMT を DBM で使っている場合は Error in MTMostVisited, while loading EntryID "XXXXXX": This does not appear to be a valid EntryID. It should be all numbers. のようなエラーが出るようので以下の修正を加える。 先日より、利用して...
Weblog: ちょっとニュース
Tracked: June 3, 2004 12:27 PM
先日来より、
「Error in MTMostVisited, while loading EntryID "XXXXXX": This does not appear to be a valid EntryID. It should be all numbers.」というエラーが出始めたので、掲載されている内容でパッチをしてみたのですが、まだエラーになるようです。
他にもあるのかなあ、原因が。とほほ。
