

如果您在使用模板编辑器时遇到了问题,请查看下面是否列出了您的问题。
如果您在使用模板编辑器时遇到了问题,请查看下面是否列出了您的问题。
问题:加载页面失败
如果您的店面包含将用户重定向到未与您的商店相连接的 URL 的代码,请在使用模板编辑器时确认此重定向已被禁用。
例如,为了根据买家所在的地点将他们定向到不同的 商店,此类型的重定向可能会被添加到店面上。此类型的重定向代码可能存在于您的模板或安装的应用中。
为了确保您的重定向不会影响编辑器体验,请在您模板的 JavaScript 代码中将 window.location.href =
替换为 window.parent.location.href =
。如果无法执行此操作,则在使用模板编辑器时在 JavaScript 中使用对 window.Shofy.designMode
变量的引用来禁用此重定向。当店面加载到编辑器中时,此变量将设置为 true
;如果未加载,此变量将设置为 false
。
由于多种原因,页面无法加载到模板编辑器中。常见问题包括以下内容:
网络连接问题
模板中的 Liquid 代码无效
如果您已验证这些问题不会导致错误,请尝试通过导航到模板编辑器中的模板操作 > 预览模板来访问您的在线商店。如果页面无法加载,您可以联系 Shopify 支持以获取有关您店面的帮助。
在模板编辑器中更改模板设置时,您可能会在编辑器中看到“发现 HTML 错误”警告消息:
当您的模板代码中存在语法错误时,会显示此错误消息。若要解决此问题,您可以检查错误消息中引用的 Liquid 文件中的代码。在上方的示例中,此代码为 slideshow.liquid
。
点击链接到错误消息的 .liquid
分区文件。这会将您定向到编辑 HTML/CSS 页面,并且文件将在代码编辑器中打开。
仔细查看文件中的代码,并尝试找到无效的 HTML 或 Liquid。代码编辑器将用红色显示潜在的语法错误。常见问题如下:
额外的结束 HTML 标记,例如,结束 </div>
没有对应的开始 <div>
额外的开始 HTML 标记,例如,开始 <div>
没有对应的结束 </div>
HTML 标记格式错误,例如,<div
缺少 >
Liquid 代码格式错误
包含的模板代码片段文件中的 HTML 已损坏
找到问题后,更正您的模板文件中的代码。
点击保存。
点击自定义以返回模板编辑器,并确认错误消息已消失。
如果您无法按照前面的步骤解决问题,请考虑以下选项:
回退到旧版模板文件
从模板商店中安装新版模板并切换到该版本
了解您的模板提供的支持类型
Troubleshooting
If you are experiencing issues with your theme editor, then check if your issue appears below.
Common issues
Issue: Failed to load the page
Page is redirecting to an unsupported URL
If your storefront includes code that redirects users to URLs that are not connected to your shop, then verify that the redirect has been disabled when you visit the theme editor.
For example, this type of redirect may be added to a storefront in order to direct buyers to different Shopify stores depending on their location. This type of redirect code could exist in either your theme or an app that you installed.
To ensure your redirect does not interfere with the editor experience, replace
window.location.href =
withwindow.parent.location.href =
in your theme’s JavaScript code. If that is not possible, use a reference to thewindow.Shopify.designMode
variable in JavaScript to disable the redirect when you visit the theme editor. This variable is set totrue
when the storefront is loaded in the editor andfalse
when it is not.Page failed to load due to an error
A page can fail to load in the theme editor for many reasons. Common issues include the following:
network connection issues
invalid Liquid code in your theme
If you have verified that these issues are not causing the error, then try visiting your online store by navigating to Theme actions > Preview theme in the theme editor. If the page fails to load, then you can contact Shopify support for help with your storefront.
HTML error found
When making changes to your theme settings in the theme editor, you might see an 'HTML error found' warning message in the editor:
This error message appears when a syntax error is found in your theme . To resolve the problem, you can examine the code in the Liquid file that is referenced in the error message. In the example above, this would be the
slideshow.liquid
.Finding the problem in your theme code
Click on the
.liquid
section file that is linked to in the error message. This will take you to the Edit HTML/CSS page, and the file will open in the code editor.Look through the code in the file and try to find invalid HTML or Liquid. The code editor will show potential syntax errors in red. Common problems include the following:
Extra closing HTML tags, for example, a closing
</div>
without an opening<div>
Extra unclosed HTML tags, for example, an opening
<div>
without a closing</div>
Malformed HTML tags, for example,
<div
without a>
Malformed Liquid code
Broken HTML in an included theme snippet file
Once you've found the problem, correct the code in your theme file.
Click Save.
Click Customize to return to the theme editor, and confirm that the error message is gone.
Other solutions
If you are unable to resolve the problem by following the previous steps, then consider the following options:
Roll back to an older version of your theme file
Install and switch to new version of the theme from the Theme Store
Find out what kind of support is available for your theme
特别声明:以上文章内容仅代表作者本人观点,不代表ESG跨境电商观点或立场。如有关于作品内容、版权或其它问题请于作品发表后的30日内与ESG跨境电商联系。
二维码加载中...
使用微信扫一扫登录
使用账号密码登录
平台顾问
微信扫一扫
马上联系在线顾问
小程序
ESG跨境小程序
手机入驻更便捷
返回顶部