6.21 カテゴリアーカイブページのデザインをカテゴリの階層別に切り替える

P.486

2階層カテゴリの場合

●パターン1

「ブログ記事リスト」アーカイブテンプレート

<mt:if name="category_archive">
  <mt:hasParentCategory>
    <mt:include name="子カテゴリーのテンプレートモジュール" />
  </mt:hasParentCategory>
  <mt:hasNoParentCategory>
    <mt:include name="親カテゴリーのテンプレートモジュール" />
  </mt:hasNoParentCategory>
</mt:if>

●パターン2

「ブログ記事リスト」アーカイブテンプレート

<mt:if name="category_archive">
<mt:hasSubCategories>
  親カテゴリーのサブテンプレート
</mt:hasSubCategories>
<mt:hasNoSubCategories>
  子カテゴリーのサブテンプレート
</mt:hasNoSubCategories>
</mt:if>

P.487

3階層カテゴリの場合

●パターン1

「ブログ記事リスト」アーカイブテンプレート

<mt:if name="category_archive">
<mt:hasSubCategories>
  <mt:hasNoParentCategory>
    <mt:include name="親カテゴリーのテンプレートモジュール" />
  </mt:hasNoParentCategory>
  <mt:hasParentCategory>
    <mt:include name="子カテゴリーのテンプレートモジュール" />
  </mt:hasParentCategory>
</mt:hasSubCategories>
<mt:hasNoSubCategories>
  <mt:include name="孫カテゴリーのテンプレートモジュール" />
</mt:hasNoSubCategories>
</mt:if>

●パターン2

「ブログ記事リスト」アーカイブテンプレート

<mt:if name="category_archive">
<mt:hasParentCategory>
  <mt:hasSubCategories>
    <mt:include name="子カテゴリーのテンプレートモジュール" />
  </mt:hasSubCategories>
  <mt:hasNoSubCategories>
    <mt:include name="孫カテゴリーのテンプレートモジュール" />
  </mt:hasNoSubCategories>
</mt:hasParentCategory>
<mt:hasNoParentCategory>
  <mt:include name="親カテゴリーのテンプレートモジュール" />
</mt:hasNoParentCategory>
</mt:if>

P.488

4階層の場合

「ブログ記事リスト」アーカイブテンプレート

<mt:if name="category_archive">
<mt:hasSubCategories>
  <mt:hasNoParentCategory>
    <mt:include name="階層1カテゴリーのテンプレートモジュール" />
  </mt:hasNoParentCategory>
  <mt:hasParentCategory>
    <mt:parentCategory>
      <mt:hasParentCategory>
  <mt:include name="階層3カテゴリーのテンプレートモジュール" />
      </mt:hasParentCategory>
      <mt:hasNoParentCategory>
  <mt:include name="階層2カテゴリーのテンプレートモジュール" />
      </mt:hasNoParentCategory>
    </mt:parentCategory>
  </mt:hasParentCategory>
</mt:hasSubCategories>
<mt:hasNoSubCategories>
  <mt:include name="階層4カテゴリーのテンプレートモジュール" />
</mt:hasNoSubCategories>
</mt:if>

ウェブページ

Powered by Movable Type 4.261

このアーカイブについて

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。