在 Shopify 中,如何找到并显示页面的当前产品标签?

In Shopify, how do I find and display the current product tag of a page?

例如,如果我在第 URL 页:

collections/tableware/plates

我想创建一个面包屑导航:

首页 >> 餐具 >> 盘子

其中 tableware 是集合名称,plates 是产品标签。我如何拉出当前的产品标签(而且只有那个产品标签,我不想在这里全部显示)?看起来应该很容易,但我仍然没有弄清楚。谢谢!

我认为 current_tags 是您要找的:

Inside collection.liquid, current_tags contains all product tags that are used to filter a collection.

对于URLcollections/some-collection/tag1current_tags包含tag1

注意current_tags是一个数组,可能包含多个标签。例如,这个 URL 当前有 3 个标签:collections/some-collection/tag1+tag2+tag3.