2016-09-14 27 views
1

Jekyll沒有正確解析帖子,我找不到錯誤; YAML的前沿問題與我們其他職位相同。以下是兩個區別:Jekyll將YAML連字符當作破折號

(1)由於某些原因,Jekyll將YAML前端底部的三個破折號渲染爲一條短線:category: German — Doch is a modal particle,。我嘗試刪除這些連字符並重新輸入它們,但這並沒有解決問題。

(2)我們正在嘗試創建一個名爲「German」的新文章。 Jekyll自動從其他帖子創建我們的類別,但在這種情況下,它不會創建「德語」類別,而是將帖子置於其自己的文件夾中。

當我在瀏覽器中打開網頁,我看到這個頂部:

layout: post author: WordBrewery title: 「How to use the German doch」 description: 「How to use and understand the German modal particle doch.」 image: hohenschwangau.jpg featured: true published: true category: German — Doch is a modal particle, a word used to indicate attitude, tone or the focus of a sentence.

這裏是YAML前物質和崗位的第一線:

--- 
 
layout: post 
 
author: WordBrewery 
 
title: "How to use the German doch" 
 
description: "How to use and understand the German modal particle doch." 
 
image: hohenschwangau.jpg 
 
featured: true 
 
published: true 
 
category: German 
 
--- 
 
*Doch* is a [modal particle](https://en.m.wikipedia.org/wiki/German_modal_particle), a word used to indicate attitude, tone or the

我將不勝感激任何幫助。

Appearance of the unparsed post

+2

文件的編碼與正常工作的文章不同嗎? – RobertKenny

+1

請務必使用不含BOM的utf-8編碼保存文件。 –

+0

謝謝你們兩位;我認爲這可能是問題所在,並在Emacs中重新編碼爲utf-8(原始版本是在Atom的Windows PC上起草的),但顯然這並沒有刪除BOM(並且BOM在空白模式下不可見)。然後,我切換到Sublime Text並嘗試以UTF-8格式打開它並將其保存爲UTF-8,並且工作正常。謝謝! – WordBrewery

回答

3

(從評論遷來回答)

你需要確保的是,降價文件編碼是正確的(UTF8無BOM)。 Jekyll在物料清單中存在BOM問題http://jekyllrb.com/docs/frontmatter/

+0

鑑於YAML明確允許BOM,這真是令人驚訝。 – flyx

+0

是的,但是這個YAML位於Jekyll解析的降價文件的頂部。 Jekyll在物料清單方面存在問題,並特別警告它http://jekyllrb.com/docs/frontmatter/ – RobertKenny