Last Updated on 2016-05-10:

Writing in the front

I’ve been using Github for almost 3 years now, and I do find github convenient and easy to use, not only in terms of version control (which I personally feel is much better than SVN), but also as a platform to keep up with the latest technologies and trends. Let’s talk about one of them today

Ps: The corresponding Github repo for this article is here: github.com/litaotao/gi…

1. The easiest step

  • Step 1: Create a new repO and clone the REPO locally

The repo name will be your Github username +.github. IO. For example, if my Github user name is Litaotao, the new repo name will be litaotao.github

Review images

Using the git command cloning templates: git clone [email protected]: litaotao/lot – blog – the template. The git

taotao@mac007:~/Desktop/tmp$git clone [email protected]:litaotao/github-blog-template.git Cloning into 'github-blog-template'... remote: Counting objects: 75, done. remote: Compressing objects: 100% (68/68), done. remote: Total 75 (delta 4), reused 72 (delta 4), pack-reused 0 Receiving objects: 100% (75/75) and 1.19 MiB | 425.00 KiB/s, done. Resolving deltas: 100% (4/4), done. Checking connectivity... done.Copy the code
  • Step 3: Copy template related files to your local repO

First, delete the.git folder in the template

taotao@mac007:~/Desktop/tmp/github-blog-template$ll ... . . drwxr-xr-x 13 taotao staff 442B May 10 10:32 .git taotao@mac007:~/Desktop/tmp/github-blog-template$sudo rm -rf .gitCopy the code

Then, copy all the files from the template to your local repo using the command cp -r github-blog-template/ your_local_repo/*

taotao@mac007:~/Desktop/tmp$cp -r github-blog-template/* your_local_repo/Copy the code

Go to the your_local_repo directory and start your local blog with the Jekyll server –watch command.

taotao@mac007:~/Desktop/tmp/your_local_repo$jekyll server --watch Configuration file: /Users/chenshan/Desktop/tmp/your_local_repo/_config.yml Source: /Users/chenshan/Desktop/tmp/your_local_repo Destination: /Users/chenshan/Desktop/tmp/your_local_repo/_site Incremental build: disabled. Enable with --incremental Generating... Done in 0.588 seconds. Auto - regeneration: enabled for '/ Users/chenshan/Desktop/TMP/your_local_repo' Configuration file: / Users/chenshan/Desktop/TMP/your_local_repo / _config yml Server address: http://127.0.0.1:4000/ Server running... press ctrl-c to stop.Copy the code

If all goes well, go to: localhost:4000 in your browser and you will see your blog. I have put two posts in the template, screenshot below.

Review images

2. Customize the configuration

If you have successfully completed the first step, congratulations, you will soon have a blog of your own. Before that, you only need to change a configuration file: github-blog-template/_config.yml. I have highlighted the changes in Chinese, please refer to the notes and my blog to configure them: Github.com/litaotao/li…

markdown: kramdown highlighter: rouge paginate: 8 permalink: /:title encoding: UTF-8 gems: [jekyll-paginate] title: IO feed: /atom.xml author_info:What's your nameMyblog: Gavatar: your profile picture address gpname: your name linkedin: your github: your github email: mailto: your email address coverimgs: [] postbgimg: [] Categories: [your_local_repo/_posts/]Copy the code

Ok, if you have changed the configuration file and it is running properly locally, you can upload it to Github.

3. In-depth reading of the directory file description

taotao@mac007:~/Desktop/github/github-blog- Template $tree ### 404 page, you can customize the ├─ 404.html ├─ README. Basically is one of the most important one file ├ ─ ─ _config. Yml # # # blog page template directory ├ ─ ─ exactly │ ├ ─ ─ the default. The HTML │ ├ ─ ─ home. HTML │ ├ ─ ─ page. The HTML │ └ ─ ─ Post.html ### blog post directory, which can be sorted by folder ### note that the blog file format must be: Time - Blog title. Md, ├── ├─ books │ ├── general exercises, exercises, exercises, exercises, exercises, exercises, exercises, exercises, exercises, exercises, exercises This is your site map. Users can access all files in this folder. For example, The user can directly access my litaotao. Making. IO / 404 HTML. Litaotao. Making. IO/images / 2. JPG # # #, for instance, When you visit litaotao.github. IO /spark-in-finance-and-investing ### you are actually visiting Litaotao.github. IO /spark-in-finance-and-investing. This is normal ### because the files in your blog directory are the ones Jekyll uses to render an HTML file, the HTML file and whatever files it needs, Will put _site this # # # dedicated directory below ├ ─ ─ _site │ ├ ─ ─ 404. HTML │ ├ ─ ─ the README. Md │ ├ ─ ─ atom. The XML │ ├ ─ ─ Books-recommend -and-summarize-on-apr-2016.html │ ├─ CSS │ ├─... │ │... │ │... │ ├ ─ ─ images │ │ ├ ─ ─ 2. JPG │ │ ├ ─ ─ spark - in - finance - 1. JPG │ │ ├ ─ ─ spark - in - finance - 2. JPG │ │ └ ─ ─ spark - in - finance - 3. JPG │ ├─ ├─ js │ ├─.html │ ├─ js │ ├... │ │... │ │... │ └ ─ ─ spark - in - finance - and - investing. HTML ├ ─ ─ the atom. The XML ├ ─ ─ CSS │ │... │ │... │ │... ├── Images │ ├ _... │ │... │ │... ├─ │ ├─ ├─ ├─ ├... │... │...Copy the code

4. To summarize

In general, the steps to build a blog on Github are as follows:

  • Create a new repo with github username + ‘.github. IO ‘and clone it locally
  • Copy all files from the template, excluding ‘.git ‘, into your repo
  • Change the ‘_config.yml’ configuration file
  • Local trial run, upload to Github

5. Other topics

The result is a simple, but mostly functional blog. In addition, there are some extension topics, interested students can Google or contact me, such as:

Review images

Review images

Review images

Review images