Jekyll static web site background engine use tutorial _ruby topics

Source: Internet
Author: User
Tags curl dot net posix git client git shell

Always want to build a personal website, because do not know PHP backstage, so in dot net opened their own blog, and then slowly to the programmer change, Dot dot Network blog can not meet the specific needs of this occupation, so with worldpress to build their own first website, Tinker after a few days worldpress, from the purchase of domain name space, modify the space domain name resolution, add templates, modify templates, understand the powerful worldpress, but Tinker played worldpress, without the power to write the article, also did not use enough time to manage, that the site died. Until now I started to tinker with Jekyll static Web site background engine, the following is a talk about Jekyll learning, and the use of Jekyll to create a site when the problems encountered.

1.Jekyll is based on github.com or bitbucket.org, the latter I did not verify, should also be supported. Does not need the database, does not need the backstage knowledge, uses the Jekyll to build individual small and medium-sized website is so simple.

2. Build the process (because I am installing Jekyll on Windows, so it will be more troublesome):

Registering a github.com account, remembering your username and registering your mailbox, will be used when git shell validates.

Because Jekyll is written based on Ruby, the Ruby environment is installed first, and the Ruby Package management tool gem

①ruby installation Address, select 32 and 64bit according to your own system, install development Kit at the same time on the linked page

After downloading the installation, you need to configure Ruby's environment variables, set the system's path in the advanced properties of the system, and then check to see if Ruby is installed successfully on the console. Enter Ruby-v.

Ruby dk.rb init//Initialize Ruby

Configure the Ruby installation directory in the config file for ruby installation:

# This configuration file contains the absolute path locations of ' All
# installed rubies ' to is enhanced to work with T He devkit.  This config
# "generated by" Ruby DK.RB Init ' step and May modified
# before running the ' Ruby DK.RB Install ' step. To include no installed
# rubies that were not automagically discovered, simply add a line below
# the triple Hyp Hens with the absolute path to the Ruby root directory.
# # # Example # # # # # # # # # # # # # # # # # # # #
---d:/ruby19trunk
#-D:/ruby

② Install the command line used by the development Kit tool

 Ruby Dk.rb Install 

③ Enter the Gem install Jekyll in the command-line tool to install Jekyll. Enter JEKYLL-V Check to see if the installation was successful. If successful, the version number is returned.

④ at the same time, you need to install the Python environment, download version 2 or version 3. Python installation Address
. You can then install the tools you need for your blog.

4.1 Need to install a Easy_install plugin

4.2 Install your favorite highlighting tool (highlight), such as Pygments, Rouge. In the _config.yml of your engineering directory you need to set up: Highlighter:rough or highlighter:pygments, otherwise it will be wrong to build the project.

Easy_install pygments

⑤ Create a simple Default blog command:

Jekyll New blog
 CD blog      //cd is a common command to reach the appropriate folder
 Jekyll serve  //use serve and server is the same effect

In your localhost:4000 there will be a default blog template generated.

Some errors are encountered during the period:

1. config file error

d:/ruby200-x64/lib/ruby/gems/2.0.0/gems/posix-spawn-0.3.9/lib/posix/spawn.rb:164
: Warning:cannot Close FD Before Spawn
' which ' is not recognized as a internal or external command,
operable program or batch file.
 Liquid exception:undefined method ' [] ' for nil:nilclass in _posts/2014-08-01-
welcome-to-jekyll.markdown
Jekyll 2.2.0 | Error:undefined method ' [] ' for Nil:nilclass

Solution: In the project configuration file need to set highlighter:rouge/pygments, portal

2. Download RubyGems question

Error:could not find a valid gem ' Jekyll ' (>= 0), this is the why:
      unable to download data from https://rubygems.org/ -Ssl_connect returned=1 errno=0 state=sslv3 read Server CE
 rtificate b:certificate verify failed (HTTPS://RUBYGEMS.G Lobal.ssl.fastly.net/quick/marshal.4.8/jekyll-1.3.0.gemspec.rz
 )

Solution: Download the security certificate file, run the following command at the command line, if prompted curl is not an external or internal specified command, then your computer is not installed Curl plug-in, you need to download the plug-in installation, a great tutorial, portal

 Curl Http://curl.haxx.se/ca/cacert.pem-o Cacert.pem

3. Install ruby not successful, prompt error, you can try to provide the domestic image of Taobao portal

So how to create your own unique personal website through GitHub?

1. Download git client, download address, download will have GitHub GUI client and git shell command line tool Two, we use git shell.

2. In git shell client input

Git init

to initialize the project;

git checkout--orphan gh-pages

Create a gh-pages branch that holds all the files for your blog, and only for that name, because github.com creates the branch by default;

git Add.
Git commit-a-M ' Just a test '

Start preparing to publish the project, remember, do not omit the English decimal point in the back;

Git remote add origin https://github.com/username/projectName.git
git push Origin gh-pages

In this way your project will be created successfully.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.