mt.Vicuna:MT-Xsearch用のテンプレートモジュールを試作。

mt.Vicunaテンプレートで、mt-xsearch.cgiを使ったタグアーカイブテンプレートを作成してみました。TagSupplementalsプラグイン(0.22)との組み合わせで利用します。

先日、Ogawa::Memorandaにて、TagSupplementalsプラグインのバージョンアップとの記事がありました。「MT-XSearchを使ったタグ検索」とのことでMT-XSearchを使った方法を試すことにしました。

今回、タグ検索結果のテンプレートモジュールをカスタマイズしてmt.Vicunaテンプレートにあわせたものにするということをおこないました。おことわりですが、本記事ではMTXSearchの導入方法は省略させていただきます。

なお、TagSupplementalsプラグインとおよび、MT-XSearchを使った動的アーカイブの実現方法等は以下を参照するとよいかと思います。(#自分も3.2のころMT-XSearchを使っていたのですがやりかたを忘れておりました)

注:今回、Tagwire PluginはつかわずMTのタグ機能のみです。あと、appnel.comより、mt-xsearch.cgi等の含まれる、mt-plus-1.01.zipをダウンロードする必要があるのですが、ワタくシが確認したところ、リンク先のファイル(mt-plus-1.01.zip)がロードされずにページ遷移になっていました。当方では以前導入していたときのファイルを探してきて使用しております。

タグ検索結果のテンプレートサンプル

テンプレートモジュールを新規作成して、テンプレート名を、XSearch TagSupplementalsとします。search_key=にはTagSupplementalsを記入しています。

InstaMT+Movable Type4.24-enでのみで動作確認をおこなったものです。

<__trans_section component="mtVicuna">
<MTSetVar name="tempName" value="system_search">
<MTSetVarBlock name="topicPathTagSearch">
<p class="topicPath">
<a href="<$MTBlogURL$>" rel="nofollow">Home</a> &gt; 
<span class="current">Search results for Tag : <$MTSearchString$></span>
</p>
</MTSetVarBlock>
<?xml version="1.0" encoding="<$MTPublishCharset$>" ?>
<!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" lang="<$MTDefaultLanguage$>" xml:lang="<$MTDefaultLanguage$>">
<head profile="http://purl.org/net/ns/metaprof">
<MTInclude module="<__trans phrase="HTML Header">">
<title>Search Results for Tag : <$MTSearchString$> - <MTBlogName encode_html="1"$></title>
</head>
<body class="individual system double">
<$MTInclude module="<__trans phrase="Header">"$>
<div id="content">
<div id="main">
<$MTVar name="topicPathTagSearch"$>
<h1>Search Results for Tag : <$MTSearchString$></h1>
<div class="entry">
<ul class="info">
<li>Tag: <em><$MTSearchString$></em></li>
<li><em><span class="count"><$MTSearchResultCount$></span></em> Hits</li>
</ul>
<dl class="headline">
<MTSearchResults>
<dt><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a><span class="date"> - Posted date: <$MTEntryDate></span></dt>
<dd>
<ul>
<li class="textBody"><$MTEntryExcerpt$></li>
<MTIfNonEmpty tag="EntryAuthorDisplayName">
<li class="author">Posted by: <span class="name"><$MTEntryAuthorDisplayName$></span></li>
</MTIfNonEmpty>
<MTIfNonEmpty tag="MTEntryCategory"><li class="category">Category: <MTEntryCategories glue=" | "><a href="<$MTCategoryArchiveLink$>" title="<MTCategoryLabel> Index"><MTCategoryLabel></a></MTEntryCategories></li></MTIfNonEmpty>
<MTEntryIfTagged><li class="tag">Tag: <MTEntryTags glue=", "><a href="<$MTCGIPath$>mt-xsearch.cgi?blog_id=<$MTBlogID$>&amp;search_key=TagSupplementals&amp;search=<$MTTagName encode_url="1"$>" rel="nofollow"><$MTTagName$></a></MTEntryTags></li></MTEntryIfTagged>
</ul>

</dd>
</MTSearchResults>
</dl>
</div>
<MTNoSearch>
<div class="section entry">
<h2>Error</h2>
<div class="textBody">
<p><__trans phrase="You did not enter anything to search for. Please try again"></p>
</div>
</div>
</MTNoSearch>

<MTNoSearchResults>
<div class="section entry">
<h2>Search Result</h2>
<div class="textBody">
<p>タグ:<em><$MTSearchString$></em> のつけられた記事は見つかりませんでした。</p>
<p>ヒント:</p>
<ul>
<li>タイプミスはありませんか?</li>
<li>他のタグを検索してみてください</li>
<li>キーワード検索をお試しください</li>
</ul>
</div>
</div>
</MTNoSearchResults>
<div class="section option">
<h2>Search Tags</h2>
<form method="get" action="<$MTCGIPath$>mt-xsearch.cgi">
<fieldset>
<legend><label for="search">Tag Search</label></legend>
<div>
   <input type="hidden" name="blog_id" value="<$MTBlogID$>" />
   <input type="hidden" name="search_key" value="TagSupplementals" />
   <input type="text" class="inputField" id="search" name="search" size="20" value="<$MTSearchString decode_url="1" encode_html="1"$>" />
   <input type="submit" class="submit" value="Search" />
</div>
</fieldset>
</form>
<!-- option end --></div>

<$MTVar name="topicPathTagSearch"$>
</div>
<!-- end div#main -->
<$MTInclude module="<__trans phrase="Utilities">"$>
<$MTInclude module="<__trans phrase="Return to page top">"$>
</div>
<!-- end div#content -->
<$MTInclude module="<__trans phrase="Footer">"$>
</body>
</html>
</__trans_section>

インデントは当方で左詰めしました。mt.Vicuna向けですのでmt.Vicunaテンプレートセットを利用していることを前提としています。

追記:2009/04/08 title要素の表示がsetvarblockを使っていたのを訂正した関係でおかしくなっていたので変更しました。

変更前

  • <title>Search Results for Tag : <$MTVar name="tagname"$> -

変更後

  • <title>Search Results for Tag : <$MTSearchString$> -

なお、当ブログでのMT-XSearch対応の準備が整いましたので、タグのページで確認することができます。

Comments:0

コメントをどうぞ。書き込む場所が不明な場合やサイトオーナーへのコンタクトは、GuestBookまでお気軽にどうぞ

Comment Form
Search

Powered by 暴想 & Dakiny&Digiclo

Feeds
Tags

All Tags

meta
Others

あわせて読みたい

全文配信同盟

my ブログネットワーク

Elsewhere

Action Streams

logo

Mozilla Firefox ブラウザ無料ダウンロード

TypePad AntiSpam