Bigcommerce Stencil声明自定义前端变量

问题描述 投票:1回答:1

我想在我的主页模板中定义一个特色类别ID列表。是否可以在前面的事项中定义自定义变量?我似乎无法让它工作:

这是templates/pages/home.html中的默认前端问题,最后是我的自定义变量featured_categories

---
products:
    new:
        limit: {{theme_settings.homepage_new_products_count}}
    featured:
        limit: {{theme_settings.homepage_featured_products_count}}
    top_sellers:
        limit: {{theme_settings.homepage_top_products_count}}
carousel: {{theme_settings.homepage_show_carousel}}
blog:
    recent_posts:
      limit: {{theme_settings.homepage_blog_posts_count}}
featured_categories: 'testing'
---

然后,在模板中,此行不会产生任何输出:

{{featured_categories}}

为什么不输出值testing?最终,我希望featured_categories成为一个类别ID的数组。这可能是使用前面的事情吗?

handlebars.js bigcommerce yaml-front-matter
1个回答
1
投票

无法声明自定义前端事件变量,因为必须在BigCommerce框架中确定这些变量。您可以自己导入把手并定义变量,但出于安全原因,它将执行客户端而不是服务器端。

© www.soinside.com 2019 - 2024. All rights reserved.