Jekyll tutorial under centos

  
 

Today, my wife said that she didn't like wordpress, and then changed to a ooxx full static blog starting with j. At that time, I was dizzy. How do I find a letter? ! It took a while to tell me to call "jekyll". Ok, I have never heard of it. . . But for my wife still want to change ~ I love my wife too ~ official website to send a hair: http://jekyllrb.com/

can be seen from the URL to get away with ruby, it really recommended installation method Is the use of the gem, but also gray is often simple: gem install jekyll

input the above command, the result gem gave a bunch of mistakes, online search failed to decide to adopt upgrade Dafa (vps above The ruby ​​is 1.8.7)

I don't dare to choose too new, it is 1.9.3-p429 (0 0!). After the installation, the next gem did not report an error (gem running report "yaml"; related errors can try to install epel-release)

Select a directory to store jekyll: ~# jekyll new xxx-site # # 生成新的 jekyll目录## cd xxx-site ~# jekyll serve ##Local jekyll

At this time, you can visit http://localhost:4000 to test whether the running is successful. Since jekyll doesn't need php, mysql, etc., the configuration of jekyll is over! (Sure enough!)

The vps itself is loaded with nginx, so the webserver task is handed over to it.

Create a new vhost file for nginx, such as my: log_format xxx.me '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''" ;$http_user_agent" $http_x_forwarded_for';server{listen 80;server_name xxx.me;index index.html;root /home/wwwroot/xxx.me/_site;access_log /home/wwwlogs/xxx.me.log xxx.me; }

It should be noted that the root directory of jekyll is ./_site, not ./(this point has been pitted for a long time...)

Then reload nginx just fine.

The configuration file of jekyll is in ./_config.yaml. For details, please see: Portal

In general, articles written with markdown are passed to ./posts by jekyll. Generated into ./site. If you are afraid of trouble, you can add the parameter -w :jekyll server -w

when running the server, so jekyll will automatically update the website. (Hurry up is a hook, second!)

2013-12-04 update:

If the body field of the new post contains Chinese, then Jekyll will prompt a parsing error during the parsing process. .

In the jekyll directory, in the convertible.rb file: self.content = File.read(File.join(base, name))

File.read() may use the system default encoding Read the file, the Chinese system is GBK, but the markdown file is utf-8 encoded, so modify the code to: self.content = File.read(File.join(base, name), :encoding => "utf -8")

will normally process posts containing Chinese.

At the same time jekyll default markdown parser maruku support for Chinese is not very good, so use RDiscount.

Install rdiscount:gem install rdiscount

Set rdiscount:

In the _config.yml file, add a line: markdown: rdiscount



Copyright © Windows knowledge All Rights Reserved