如果您在使用模板編輯器時(shí)遇到了問題,請(qǐng)查看下面是否列出了您的問題。
如果您在使用模板編輯器時(shí)遇到了問題,請(qǐng)查看下面是否列出了您的問題。
問題:加載頁面失敗
如果您的店面包含將用戶重定向到未與您的商店相連接的 URL 的代碼,請(qǐng)?jiān)谑褂媚0寰庉嬈鲿r(shí)確認(rèn)此重定向已被禁用。
例如,為了根據(jù)買家所在的地點(diǎn)將他們定向到不同的 商店,此類型的重定向可能會(huì)被添加到店面上。此類型的重定向代碼可能存在于您的模板或安裝的應(yīng)用中。
為了確保您的重定向不會(huì)影響編輯器體驗(yàn),請(qǐng)?jiān)谀0宓?JavaScript 代碼中將 window.location.href =
替換為 window.parent.location.href =
。如果無法執(zhí)行此操作,則在使用模板編輯器時(shí)在 JavaScript 中使用對(duì) window.Shofy.designMode
變量的引用來禁用此重定向。當(dāng)?shù)昝婕虞d到編輯器中時(shí),此變量將設(shè)置為 true
;如果未加載,此變量將設(shè)置為 false
。
由于多種原因,頁面無法加載到模板編輯器中。常見問題包括以下內(nèi)容:
網(wǎng)絡(luò)連接問題
模板中的 Liquid 代碼無效
如果您已驗(yàn)證這些問題不會(huì)導(dǎo)致錯(cuò)誤,請(qǐng)嘗試通過導(dǎo)航到模板編輯器中的模板操作 > 預(yù)覽模板來訪問您的在線商店。如果頁面無法加載,您可以聯(lián)系 Shopify 支持以獲取有關(guān)您店面的幫助。
在模板編輯器中更改模板設(shè)置時(shí),您可能會(huì)在編輯器中看到“發(fā)現(xiàn) HTML 錯(cuò)誤”警告消息:
當(dāng)您的模板代碼中存在語法錯(cuò)誤時(shí),會(huì)顯示此錯(cuò)誤消息。若要解決此問題,您可以檢查錯(cuò)誤消息中引用的 Liquid 文件中的代碼。在上方的示例中,此代碼為 slideshow.liquid
。
點(diǎn)擊鏈接到錯(cuò)誤消息的 .liquid
分區(qū)文件。這會(huì)將您定向到編輯 HTML/CSS 頁面,并且文件將在代碼編輯器中打開。
仔細(xì)查看文件中的代碼,并嘗試找到無效的 HTML 或 Liquid。代碼編輯器將用紅色顯示潛在的語法錯(cuò)誤。常見問題如下:
額外的結(jié)束 HTML 標(biāo)記,例如,結(jié)束 </div>
沒有對(duì)應(yīng)的開始 <div>
額外的開始 HTML 標(biāo)記,例如,開始 <div>
沒有對(duì)應(yīng)的結(jié)束 </div>
HTML 標(biāo)記格式錯(cuò)誤,例如,<div
缺少 >
Liquid 代碼格式錯(cuò)誤
包含的模板代碼片段文件中的 HTML 已損壞
找到問題后,更正您的模板文件中的代碼。
點(diǎn)擊保存。
點(diǎn)擊自定義以返回模板編輯器,并確認(rèn)錯(cuò)誤消息已消失。
如果您無法按照前面的步驟解決問題,請(qǐng)考慮以下選項(xiàng):
回退到舊版模板文件
從模板商店中安裝新版模板并切換到該版本
了解您的模板提供的支持類型
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
特別聲明:以上文章內(nèi)容僅代表作者本人觀點(diǎn),不代表ESG跨境電商觀點(diǎn)或立場(chǎng)。如有關(guān)于作品內(nèi)容、版權(quán)或其它問題請(qǐng)于作品發(fā)表后的30日內(nèi)與ESG跨境電商聯(lián)系。
二維碼加載中...
使用微信掃一掃登錄
使用賬號(hào)密碼登錄
平臺(tái)顧問
微信掃一掃
馬上聯(lián)系在線顧問
小程序
ESG跨境小程序
手機(jī)入駐更便捷
返回頂部