在某些页面上显示link_list菜单
我想在我的产品页面上的标题中显示某个菜单,而不是在网站范围内显示。
我的theme.liquid
文件具有{%章节'header'%}
在< body>
中标记,因此我的标头在所有页面都如预期的。
部分/header.liquid
具有以下架构:
{% schema %}
{
"name": "Header",
"settings": [
{
"type": "link_list",
"id": "menu",
"default": "main-menu",
"label": "Heading Navigation Menu"
}
]
}
{% endschema %}
我认为当您进入Shopify上的主题编辑器时,您可以单独选择我的'heading菜单中显示的内容导航菜单“每页”部分(主页,收藏,博客等),但此时是静态的。理想情况下,我可以进入那里,并在导航设置中为某些页面选择一个不同的菜单。
I'd like to get a certain menu to display in the header on my product page instead of site-wide.
my theme.liquid
file has the {% section 'header' %}
tag within the <body>
so my header is showing fine on all pages as expected.
the sections/header.liquid
has the following schema:
{% schema %}
{
"name": "Header",
"settings": [
{
"type": "link_list",
"id": "menu",
"default": "main-menu",
"label": "Heading Navigation Menu"
}
]
}
{% endschema %}
I thought when you go into the theme editor on Shopify that you'd be able to individually select what shows up in the in menu part of my 'Heading Navigation Menu' section per page (Home, Collections, Blog, etc.), but at this point it's static. Ideally I'd be able to go in there and select a different menu I create in the Navigation setting for certain pages.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终使用开关语句和
模板
对象来处理此操作。在我的
部分/header.liquid
的导航栏中,我创建了Switch语句:您可以将您喜欢的任何元素放在各个情况下,它将检查您的模板名称所在。
两者的shopify文档:
不确定这是否是最有效的方法,但希望这可以帮助任何人尝试尝试完成类似的事情。
I ended up handling this with a switch statement and the
template
object.In my navigation bar in my
sections/header.liquid
I created the switch statement:You can put whatever element you like inside of the individual cases and it will check whatever your template name is to put display that element.
Shopify documentation for both:
Not sure if this is the most effective way to do this, but hope this helps anyone trying to accomplish something similar.