Your Title
2013年07月31日

1. 启动本地Jekyll服务(Run Jekyll Locally)

输入下面的命令。

cd USERNAME.github.com
jekyll serve

其中,USERNAME是你的github博客用户名,也就是说需要先定位到本地博客的根目录下。 然后,就可以通过来访问你的博客了。

2. 停止本地Jekyll服务(Stop Jekyll Locally)

在控制台窗口中使用快捷键来停止服务:

Ctrl+C

3. 创建一个post

rake post title="Hello World"

4. 创建一个page

rake page name="about.md"

5. 删除post或page

直接删除相应的post文件即可删除一个post。

6. 上传新添加的内容

只需要将新添加的内容上传到Github,Jekyll就可以帮我们生成相应的网页了。上传内容的命令如下。

git add .
git commit -m "Add new content"
git push origin master

7. 中文编码问题

修改convertible.rb文件中的以下行:

self.content = File.read(File.join(base, name))

加入utf-8支持,改后为:

self.content = File.read(File.join(base, name), :encoding => 'utf-8')

改后即可正常处理包含中文的post。 如果编译出现如下错误

Liquid Exception: incompatible character encodings: UTF-8 and GBK

可以尝试更改控制台编码:chcp 65001,改后控制台变得比较丑,但总算能解决中文编码问题。


How to Fix

1. Check the Start of the File

Please open _posts/码农/2013-07-31-jekyll.md and ensure the very first lines look like this:

```markdown

--- layout: post title: "Your Title" date: 2013-07-31 categories: 码农 --- ``` - The first line must be exactly `---` (no spaces, no BOM, no tabs). - There must be a closing `---` before the content starts. ### 2. Check File Encoding - Open the file in VSCode or Notepad++. - Make sure it is saved as **UTF-8 without BOM**. ### 3. Check for Hidden Characters - Sometimes, copying from other editors introduces invisible characters. - In VSCode, you can use the "Reopen with Encoding" option and resave as UTF-8. --- ## Next Step **Please copy and paste the first 10 lines of `_posts/码农/2013-07-31-jekyll.md` here.** I can then directly spot the problem for you. Or, if you prefer, check the above points yourself and let me know if the error persists!