記事本文
AllKeywords Plugin を存分に活用しよう
既に AllKeywords Plugin とキーワードによるテンプレートで AllKeywords Plugin の素晴らしさをとくと語ったところですが、実際にどう導入すれば良いかをまとめて、更に利用者を呼び込もうという目論見です。
なお、これ以降の項は Ogawa::Memoranda: AllKeywords Plugin および Ogawa::Memoranda: AllKeywords PluginとMT-XSearchの連携の 2 つの記事およびそれに付随するコメントなどをよく読んだことを前提として書いています。 また、必要なプラグインはダウンロード済と仮定します。 ちなみに、 MT-XSearch を使わない方法もありますが、この記事では割愛します。
AllKeywords Plugin をインストール
- all-keywords.zip を解凍します。
- all-keywords.pl を install directory/plugins/all-keywords.pl に put します。
MT-XSearch をインストール
- MT-XSearch のアーカイブを解凍します。
-
- plugins\mt-grep.pl を install directory/plugins/mt-grep.pl に put します。
- plugins\mt-xsearch.pl を install directory/plugins/mt-xsearch.pl に put します。
- extlib\MT\XSearch.pm を install directory/extlib/MT/XSearch.pm に put します。
- Ogawa::Memoranda: AllKeywords PluginとMT-XSearchの連携を参考に、 mt-xsearch.cgi にパッチを適用します。
- mt-xsearch.cgi を install directory/mt-xsearch.cgi に put します。
- mt-xsearch.cgi のパーミッションを実行可能な状態にします。 ( これはサーバ等の環境によって異なるので、具体的な値は各々違います。 XREA の場合だと 700 になります。 )
AllKeywords Plugin と MT-XSearch を連携させる
- XSearch AllKeywords という名前のテンプレートモジュールを作成します。モジュールの作成例は Ogawa::Memoranda: AllKeywords PluginとMT-XSearchの連携 を参照してください。
- <$MTBlogURL$>.htaccess を編集します。
RewriteEngine on RewriteRule ^tag/(.*)$ /mt/mt-xsearch.cgi?blog_id=1&search_key=AllKeywords&search=$1^tag/(.*)$や/mt/mt-xsearch.cgiやblog_id=1の部分は適宜環境に応じて変更してください。
失敗例
- キーワードによるサーチを行うと、 Execution of this script not permitted で始まるエラーメッセージが出る
-
mt-xsearch.cgi のパーミッションが不適切な値になっています。
- キーワードによるサーチを行うと、 Got an error: Can't call method "build" without a package or object reference at <$MTCGIPath$>/mt-xsearch.cgi line **. というエラーメッセージが出る
-
テンプレートモジュール XSearch AllKeywords の名前を間違えているか、あるいは XSearch AllKeywords が未作成のままです。
tips
- 空白を含むキーワード ( 例 : Movable Type ) も扱いたい
-
RewriteEngine on RewriteRule ^tag/(.*)$ /mt/mt-xsearch.cgi?blog_id=1&search_key=AllKeywords&delimiter=,&search=$1.htaccess の記述を上記のように変更すると、キーワードのデリミタ ( 区切り文字 ) を
,として扱うようになります。AllKeywords Plugin は、
デフォルトでは空白文字(スペース、タブ)をデリミタとする
ため、次に羅列するコンテナタグをテンプレート内で使う場合は、delimiter=","という指定を合わせて行うようにしてください。- MTAllKeywords コンテナタグ
- MTEntryAllKeywords コンテナタグ
- MTEntriesWithKeywords コンテナタグ
- MTMostRelatedEntries コンテナタグ

