> ## Documentation Index
> Fetch the complete documentation index at: https://foliant-help.iforiti.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 範本顯示錯誤或無法預覽

> 了解範本編輯器中的程式碼錯誤、修正無法顯示的預覽，並找出範本變更未出現在文件上的原因。

範本的程式碼有錯誤時，編輯器會告訴您錯誤的位置，預覽則會等到錯誤修正後才更新。本文說明這些訊息的意思，以及變更未出現在文件上時該怎麼做。

## 編輯器中的程式碼錯誤

**程式碼錯誤**橫幅會列出每個問題及其行號，例如 *Line 12 - Unknown Liquid filter: 'money\_with\_curency'*。選取**跳至該行**即可跳到該處。

常見錯誤：

| 錯誤 | 通常代表的意思 |
| - | - |
| *Unclosed Liquid tag* 或 *Unclosed Liquid output tag* | 某個 `{% ... %}` 或 `{{ ... }}` 缺少結尾的 `%}` 或 `}}`。 |
| *Unknown Liquid filter* 或 *Unknown Liquid tag* | 拼字錯誤，或使用了只適用於 Shopify 佈景主題的篩選器或標籤。 |
| *Unknown Liquid object* | Foliant 無法辨識的變數名稱。請檢查拼字。 |
| *Liquid syntax error* | Liquid 陳述式的格式有誤，例如 `if` 缺少 `endif`。 |
| *Unclosed '`<div>`' tag*、*Unexpected closing tag* 或 *Missing closing ...* | HTML 標籤沒有正確對應。 |
| *Unknown CSS property* | 樣式中有拼字錯誤。 |

有錯誤時，預覽會顯示 *Fix code errors to update the preview*。您也無法切換到視覺化編輯器：*Fix the code errors before switching to Visual.*

## 預覽無法顯示

| 訊息 | 處理方式 |
| - | - |
| *Couldn't render the preview. Check the template for Liquid errors.* | 找出編輯器沒偵測到的錯誤，例如篩選器用在錯誤類型的值上。也可以換一筆訂單試試預覽。 |
| *The PDF couldn't be rendered. Fix any errors in the template and try again.* | 修正錯誤後，再次選取**預覽 PDF**。 |
| *Unsaved changes detected*：*Please save your changes to generate a preview.* | 儲存範本。 |
| **由較新版本的 Foliant 儲存** | 重新載入頁面，即可編輯範本的區塊。 |

如果您找不到錯誤，可以從範本的紀錄中還原較早的版本。請參閱[範本紀錄](https://foliant-help.iforiti.com/zh-Hant/templates/version-history.md)。

## 變更沒有出現在文件上

* **需要發布。**如果**設定 › 文件與列印**中已開啟**需要發布**，您對範本程式碼、浮水印或紙張大小所儲存的變更，在發布前都只是草稿。顧客、匯出和列印仍會使用已發布的版本。
* \*\*文件已鎖定。\*\*已開立且已鎖定的發票和折讓單永遠不會變更。請參閱[已鎖定的發票](https://foliant-help.iforiti.com/zh-Hant/invoices-and-numbering/locked-invoices.md)。
* \*\*最近開啟過顧客連結。\*\*下載連結會在幾分鐘內套用範本變更。
* \*\*該訂單使用的是其他範本。\*\*請在範本指派中確認該訂單套用的是哪個範本。

## 小提醒

* 您在列印頁面上所做的單次編輯不會儲存到範本中。
* 有些資料會刻意顯示為空白：貨運清單或揀貨單涵蓋多筆訂單，因此單筆訂單的資料（例如訂單編號）在這些文件中會是空白的。

## 相關文章

* [程式碼編輯器](https://foliant-help.iforiti.com/zh-Hant/template-editor/code-editor.md)
* [範本紀錄](https://foliant-help.iforiti.com/zh-Hant/templates/version-history.md)
* [文件或頁面無法載入](https://foliant-help.iforiti.com/zh-Hant/troubleshooting/documents-dont-load.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.