4月 08 2010

[MT備忘録]パンくず用メモ:ウェブページで自分がindex.htmlならパンくずのフォルダTOPを省略

Posted by きつねのボタン in MovableType, MTテンプレ習作

パンくずナビ用メモ。フォルダ1階層前提の猛烈シンプルなやつメモっておく。

  • ファイル名がindex.html の時 →  ホーム > ページタイトル(リンクなし)
  • ファイル名がindex以外の時  →  ホーム > フォルダ名(リンク) > ページタイトル
<li><a href="/">ホーム</a>&nbsp;&gt;</li>
<mt:unless tag="PageBasename" eq="index">
    <li><a href="./"><$mt:FolderLabel$></a>&nbsp;&gt;</li>
</mt:unless>
<li><$mt:PageTitle$></li>

もう少し使えそうなコード↓。

<mt:SetVarBlock name="topicpath">
    <a href="<$mt:Var name='website_path'$>index.html" title="ホーム">ホーム</a> &raquo;
    <mt:If name="main_index"><strong><$mt:BlogName$></strong>
    <mt:Else><a href="<$mt:Var name='blog_path'$>index.html" title="<$mt:BlogName$>"><$mt:BlogName$></a> &raquo;
    </mt:If>
</mt:SetVarBlock>

<mt:If name="page_archive">
    <mt:SetVarBlock name="topicpath" append="1">
        <mt:Unless tag="PageBasename" eq="index">
            <mt:ParentFolders>
                <a href="<$mt:BlogURL$><$mt:FolderPath$>"><$mt:FolderLabel$></a> &raquo;
            </mt:ParentFolders>
            <strong><$mt:PageTitle remove_html="1"$></strong>
        <mt:Else>
            <mt:ParentFolders exclude_current="1">
                <a href="<$mt:BlogURL$><$mt:FolderPath$>"><$mt:FolderLabel$></a> &raquo;
            </mt:ParentFolders>
            <strong><$mt:FolderLabel$></strong>
        </mt:Unless>
    </mt:SetVarBlock>
</mt:If>