BigCommerce在首页上显示品牌(模具)

时间:2018-07-31 20:20:11

标签: handlebars.js bigcommerce yaml-front-matter

我需要在BigCommerce主题的主页上显示品牌集合。主题是使用Stencil和Handlebars.js。页面顶部的“我的前题”块如下:

在页面顶部的

YAML

---
carousel: true
products:
  new:
    limit: {{theme_settings.home-new-products}}
  featured:
    limit: {{theme_settings.home-featured-products}}
  top_sellers:
    limit: {{theme_settings.home-top-selling-products}}
blog:
  recent_posts:
    limit: 3
    summary: {{theme_settings.home-blog-summary-length}}
brands:
  limit: {{theme_settings.brands-count}}
---

Handlebars.js (位于首页的下方)。

<ul class="brand-items-list">
    {{#each brands}}
      <li class="brand-item {{#unless image}}no-brand-image{{/unless}}">
        {{#if image}}
          <figure class="brand-item-image-container">
            <a href="{{url}}">
              <img
                class="brant-item-image brand-name"
                src="{{getImage image 'thumb'}}"
                alt="{{name}}"
              >
              <span class="brand-name">{{name}}</span>
            </a>
          </figure>
        {{else}}
          <a class="brand-item-title" href="{{url}}">
            <span class="brand-name">{{name}}</span>
          </a>
        {{/if}}
      </li>
    {{/each}}
  </ul>

据我了解, brands 应该返回可以在任何页面上迭代的品牌对象的集合。 BigCommerce Front-Matter Documentation

我遇到的问题是,在首页上使用{{品牌}}时为空。

0 个答案:

没有答案