4.2xのコメントリプライお試しの続き

MovableType4.2xのコメント返信機能つきテンプレートの編集。前回のものはmicroformatsをあまり意識してなかったのでその点だけ修正してみました

この記事は以下の記事の続きになります。コメント返信機能をmt.Vicunaテンプレートに適用させるといった内容です。

テンプレートの変更

当該記事に示しましたテンプレート(のコード)のdt要素の部分だけ抜粋します。

<dt<MTIfArchiveTypeEnabled archive_type="Individual"> id="comment-<$MTCommentID$>"</MTIfArchiveTypeEnabled>>
<span class="name">
<MTIfNonEmpty tag="CommentAuthorIdentity">
<$mt:CommentAuthorIdentity$>
</MTIfNonEmpty>
<mt:IfCommentParent>
<span class="vcard author"><$mt:CommentAuthorLink default_name="Anonymous" show_email="0" spam_protect="1"$></span> replied to <a href="<mt:CommentParent><$mt:CommentLink$></mt:CommentParent>">comment from <mt:CommentParent><$mt:CommentAuthor$></mt:CommentParent></a>
<mt:Else><span class="vcard author"><$mt:CommentAuthorLink$></span>
</mt:IfCommentParent>
| <span class="date"><a href="<$mt:CommentLink$>"><$mt:CommentDate$></a></span>
<mt:IfCommentsAccepted>
| <$mt:CommentReplyToLink$>
</mt:IfCommentsAccepted>
</span>
</dt>

以下のよう書き換えをおこないます。

class="name"のところは、class="vcard autor name"class="vcard author"のところは、class="fn"のようにしてみます。書き換え後のテンプレートは以下のようになります。

<dt<MTIfArchiveTypeEnabled archive_type="Individual"> id="comment-<$MTCommentID$>"</MTIfArchiveTypeEnabled>>
<span class="vcard author name">
<MTIfNonEmpty tag="CommentAuthorIdentity">
<$mt:CommentAuthorIdentity$>
</MTIfNonEmpty>
<mt:IfCommentParent>
<span class="fn"><$mt:CommentAuthorLink default_name="Anonymous" show_email="0" spam_protect="1"$></span> replied to <a href="<mt:CommentParent><$mt:CommentLink$></mt:CommentParent>">comment from <mt:CommentParent><$mt:CommentAuthor$></mt:CommentParent></a>
<mt:Else><span class="fn"><$mt:CommentAuthorLink$></span>
</mt:IfCommentParent>
| <span class="date"><a href="<$mt:CommentLink$>"><$mt:CommentDate$></a></span>
<mt:IfCommentsAccepted>
| <$mt:CommentReplyToLink$>
</mt:IfCommentsAccepted>
</span>
</dt>

class="url fn"としたいところなのですが、MTCommentAuthorLinkの出力が、コメントフォームでURL・メールアドレス共に記載されなかった場合、リンクはつかないという動作のために「コメント投稿者のリンクがあるかないか」の判断をおこなう処理が必要になってくるようなのでfnのみにしてあります。