如果您在使用模板編輯器時遇到了問題,請查看下面是否列出了您的問題。
如果您在使用模板編輯器時遇到了問題,請查看下面是否列出了您的問題。
問題:加載頁面失敗
如果您的店面包含將用戶重定向到未與您的商店相連接的 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跨境小程序
手機入駐更便捷
返回頂部