You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Shopify Empire主题添加自定义HTML页脚区块问题求助

Shopify Empire主题页脚自定义HTML字段添加方案
  • 问题:为Shopify页脚添加自定义HTML字段时,按常规方法添加区块代码后无法显示内容,系统提示需添加类型检查,但Empire主题的/sections/footer.liquid中找不到{%- case block.type -%}代码段。

已尝试的代码:

  1. 在footer.liquid的blocks数组中新增区块配置:
{ "type": "html_content", "name": "HTML Content", "settings": [ { "type": "html", "id": "html_area", "label": "Custom HTML", "default": "<div><p>Some HTML content</p></div>" } ] }
  1. 常规主题需在case代码块中添加类型检查(但Empire主题无此代码段):
{%- case block.type -%} 
  {%- when 'newsletter' -%} 
    . . . 
  {%- when 'text' -%} 
    . . . 
  {%- when 'link_list' -%} 
    . . . 
  {%- when 'html_content' -%} 
    {{ block.settings.html_area }} 
{%- endcase -%}

Empire主题适配操作

Empire主题的页脚区块渲染未采用case语句,需修改区块循环代码:

  • 找到footer.liquid中{% for block in section.blocks %}开头的循环段
  • 在循环内部添加类型判断逻辑:
{% if block.type == 'html_content' %}
  {{ block.settings.html_area }}
{% else %}
  <!-- 保留原有的区块渲染代码 -->
{% endif %}

完成修改后保存并刷新主题自定义器,即可在页脚添加并显示自定义HTML内容。

内容的提问来源于stack exchange,提问作者Suleyman Gokgul

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 00:20:00