post_categories_pannel.liquid

post_categories_pannel.liquid用於展示部落格文章分類區塊

desktop

desktop

mobile

mobile


變數

變名稱類型描述
post_categoriesArray部落格文章分類列表
post_categories[].nameString部落格文章分類名稱
post_categories[].urlString部落格文章分類
post_categories[].posts_countInteger連結部落格文章分類下包含文章數量

範例

以下是部落格文章分類面板代碼範例:

{% if post_categories and post_categories.size > 0 %}
  <post-categories-pannel>
    <div class="post-categories-pannel__block">
      <div class="post-categories-pannel__block-title">
        {{ 'shopline_translations.themes.blog.all_categories' | translate }}
      </div>
      <div class="post-categories-pannel__block-list">
        {% for cat in post_categories %}
          <a href="{{ cat.url }}">
            <span class="name">{{ cat.name }}</span>
            <span class="count">
              <svg>
                <use xlink:href="#icon-note"></use>
              </svg>
              {{ cat.posts_count }}
            </span>
          </a>
        {% endfor %}
      </div>
    </div>
  </post-categories-pannel>
{% endif %}