Step 1: First, let's take a look at the file directory to be created locally.
/jun_demo |-- _config.yml |-- _layouts | |-- default.html |-- _posts | |-- 2014-06-26-hello-world.html |-- index.html
Config. yml: configuration settings
_ Layouts: Template storage folder
Default.html: file template
_ Posts: directory for storing blog articles
2014-06-26-hello-world-html: blog article
Index.html: homepage of the article
Step 2: Configuration
// Create the folder jun_demo and perform git Initialization on the directory
$ Mkdir jun_demo
$ CD jun_demo $ git init
//Create a branch GH-pages without a parent node. The website is generated only on pages in the branch.
$ Git checkout -- orphan GH-pages
Step 3:Add content to the file directory created above
1 config. yml (only set this property for other properties see: http://jekyllrb.com/docs/configuration)
baseurl:/jun_demo
2 default.html
<!DOCTYPE html>
3 2014-06-26-hello-world-html (the part between "---" is the blog page settings, where layout is the selection template and title is page. Title)
--- Layout: default title: Hello, world --- <H2 >{{ page. title }}</H2> <p> my first article </P> <p >{{ page. date | date_to_string }}</P>
4 index.html
--- Layout: default title: my blog --- <H2> {page. title }}</H2> <p> latest article </P> <ul> {% for post in site. posts %} <li >{{ post. date | date_to_string }}< a href = "{site. baseurl }{{ post. URL }}" >{{ post. title }}</A> </Li >{% endfor %} </ul>
Step 4:Submit
// Add to local database
$ Git Add. $ git commit-M "First Post"
// Replace username in the service library with your GitHub account name, And jun_demo.git also serves as your repository name on the server.
$ Git remote add origin https://github.com/username/jun_demo.git
$ Git push origin GH-pages
Step 5:Visit your site at http://username.github.com/jun_demo/ (replace username with your username)
Note: This article is the reading summary, the original address is http://www.ruanyifeng.com/blog/2012/08/blogging_with_jekyll.html